,monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> address varchar2(50),monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> email varchar2(25),monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> tel number(11)
名称的:
userInfo (
,--主键
,--非空
18,monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> email varchar2(25) ,--唯一
dept(deptno)—外键
名称:
id_pk ,monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> name varchar2(20) name_nn ,monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> sex number(1),monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> age number(3) 18,monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> birthday ,monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> address varchar2(50),monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> email varchar2(25) email_uqe ,monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> tel number(11),monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> deptno number(2) dept_deptno_ref dept(deptno)
id_pk (id),--也可以两个以上,联合主键
dept_deptno_ref (deptno) dept(deptno),monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> emial_name_uqe (email,name)
userInfo (msn varchar2(20));
userInfo (msn varchar2(25));
userInfo (msn);
userInfo id_pk;
userInfo id_pk (id);
v$_dept_view
deptno,dname dept;
v$_dept_view compile;
提示:视图一般是一个表或多个表的查询或子查询,这样可以减少代码量,但同时增加了对数据库视图的维护程度,如:某个表字段被删除或是修改,视图也要重新创建或修改,同时占用了数据库的一部分空间;视图就是一个虚拟的表格;
idx_dpt_dname dept(dname);
idx_dept_dname_deptno dept(dname,deptno);
idx_emp_ename scott.emp(ename);
idx_emp_rev_no scott.emp(empno) reverse;
bitmap idx_emp_name scott.emp(dname);
tab (
,monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> name varchar2(20)
;
idx_name (col) /;
提示:当给表创建主键或唯一键约束时,系统也会创建一个约束给该字段;同样创建索引也会占用数据库空间;索引在访问、查询的时候效率有提高,但是在修改表的时候效率就会降低;
seq;
seq.nextval dual;
tab (sql.nextval,‘music’);
seqtab
2 –从2开始
3—每次加3
修改序列 ,不能修改起始值
seqtab
synonym scott_emp scott.emp;
synonym scott_dept scott.dept;
* scott_emp;
* scott_dept;
tablespace HooMS
5M
2M maxsize 10M;
用户、分配可以操作表空间
hoo
hoo
tablespace HooMS
tablespace temp;
tablespace myMS
1M
;
修改表空间大小
添加数据文件
tablespace myMS
datafile
1M;
文件自动增长
2M maxsize 4M;
重命名
hooMS;
tablespace hooMS
;
;
tablespace hooMS online;
删除无数据的表空间
tablespace hooMS;
删除带数据的表空间
tablespace hooMS