Oracle笔记
主编:够潮
版本:V.20110325
创建表空间:
create tablespace gouchao[A1]
datafile 'f:\xyc01.dbf[A2] ' size 50m;
用户:
创建用户:
create user xuyongchao3[A3] identified by xyc[A4]
default tablespace gouchao[A5]
temporary tablespace temp[A6] ;
修改用户密码:
alter user xuyongchao identified by gouchao[A7] ;
设置密码过期:
alter user gouchao password expire;
锁定用户:
alter user xuyongchao account lock[A8] ;
为用户解锁:
alter user xuyongchao account unlock[A9] ;
为用户授权:(系统权限)
grant connect[A10] ,resource ,create table ,create session ,create procedure to xuyongchao[A11] ;、
为用户授数据对象权限:
grant select[A12] on scott.emp[A13] to gouchao;
为用户撤销权限:
revoke connect[A14] from gouchao;
创建角色:
create role student[A15] ;
为角色授权:
grant select any table ,connect[A16] ,resource to student with admin option;
为用户授角色:
grant student[A17] to xuyongchao;
为用户撤销角色
revoke teacher[A18] from xuyongchao;
删除角色:
drop role teacher;
在数据字典中查询用户信息,授权情况。角色信息
查询用户信息:
select * from dba_users;
select * from dba_users where username='XUYONGCHAO';
授权情况:
conn xuyongchao/xyc
select * from user_sys_privs[A19] ;
角色信息:
conn xuyongchao/xyc
select * from user_role_privs[A20] ;
序列
查看当前用户所创建的序列:
select * from user_sequences;
创建序列:
create sequence S_userno[A21]
start with 50[A22] increment by 10[A23]
MAXvalue 99[A24] cache 10[A25] ;
修改序列 :
alter sequence S_userno
maxvalue 200 cache 20 ;
删除序列:
drop sequence S_userno
使用序列:
nextVal[A26] :用于返回下一个序列号
Curral:用于返回当前序列号
insert into user(userno ,username) values(S_userno.Nextval[A27] ,'33');
同义词:
同义词是方案对象的别名,作用:1)简化对象访问2)提高对象访问的安全性
建立公共同义词:
create public synonym public_emp[A28] for scott.emp[A29] ;
使用同义词
select * from public_emp;
建立私有同义词:
create synonym private_emp for scott.emp;
删除公共同义词:
drop public synonym public_emp;
删除私有同义词
drop synonym private_emp;
表:
建表:
create table user_list
(
user_name varchar2(23),
user_age int
);
查看表结构:
desc user_list;
添加字段:
alter table user_list
add (userno int );
修改字段:
alter table user_list
modify ( user_name varchar2(50));
删除字段:
alter table user_list
drop column user_age;
对表添加数据:
insert into user_list(user_name ,userno) values('gouchao' ,10001);
insert into user_list values('xuyongchao',10003);
insert into user_list values('gouchao' ,S_userno.Nextval[A30] );
对表修改数据 :
update user_list
set user_name[A31] ='gouli' where user_name ='gouchao';
对表删除数据:
delete from user_list where userno = 10001;
删除表格:
drop table user_list;
查询:
查询所有记录:
select *[A32] from user_list;
select userno[A33] from user_list;
select userno ID [A34] from user_list;
select user_list[A35] .userno from user_list;
select a.userno from user_list a[A36] ;
查询所有记录的某些字段:
select empno ,ename from emp;
查询某些字段的不同记录:
select distinct[A37] job from emp;
单条件 的查询:
=
select * from emp where job='CLERK';
!=
select * from emp where job!='CLERK';
>
select * from emp where sal > 1600;
<
select * from emp where sal < 1600;
>=
select * from emp where sal >=1600;
<=
select * from emp where sal <= 1600;
in
select * from emp where sal in (1600,3000);
not in
select * from emp where sal not in(1600,3000);
between and
select * from emp where sal between 1600 and 3000 ;
Like
select * from emp where job like 'M%';
select * from emp where job like 'M_';
select * from emp where job like 'MANAGE_';
not like
elect * from emp where job not like 'M_';
select * from emp where job not like 'M%';
Is null
select * from emp where sal is null;
select * from emp where job is null;
Is not null
select * from emp where sal is not null;
select * from emp where job is not null;
组合条件的查询:
and
select * from emp where job ='CLERK' and sal <3000;
or
分享到:
相关推荐
Oracle笔记Oracle笔记Oracle笔记Oracle笔记Oracle笔记Oracle笔记
韩顺平oracle笔记(免费)韩顺平oracle笔记(免费)
初学Oracle 最最需要的东东 史上最全的oracle笔记
oracle笔记创建和管理表,增加列,删除列,修改列,修改列名和数据类型和长度,修改表名等等操作,有代码案例!
马士兵oracle笔记,浅显易懂。
oracle笔记!!!!!!!!!!!!!!!!!!!!!!!!!!!!
oracle学习笔记,包括oracle常用的语法和个人总结。
达内,tarena,oracle笔记,oraclePPT课件,达内oracle笔记 包含达内数据库脚本
oracle 详细笔记,玩转oracle,简单,快捷的学习oracle
CSDN确有不少好的资源,但很多都要积分,有的还要的很多,这样有些人苦于积分...这个资源是不要积分的,如果你想学Oracle,这无疑是最好的参考之一。反正不要积分,不妨下来一看。如果不好,也不用因为痛失积分而懊恼。
里面主要啊hi学习Oracle时的一些笔记,希望能帮助到需要的初学者
适合初学者的Oracle教材,可以配合网上的2011版李兴华老师的Oracle教学视频一起使用,有大量的习题和对应的答案。
Oracle 笔记
达内培训 2010年 Oracle 笔记全 奉献给喜欢的哥们们~ 希望对你们有帮助!
Oracle 笔记.rar Oracle 笔记.rar Oracle 笔记.rar Oracle 笔记.rar Oracle 笔记.rar
世界上最全的oracle笔记 oracle 资料世界上最全的oracle笔记 oracle 资料