目录oracle
一个表空间能够包含1至n个数据文件
一个数据文件必然属于某个表空间app
create tablespace mytbs datafile '/u01/app/oracle/oradata/orcl/data_1.dbf' size 100m; create tablespace mytbs2 datafile '/u01/app/oracle/oradata/orcl/data_2.dbf' size 100m, '/u01/app/oracle/oradata/orcl/data_3.dbf' size 100m; //建立临时表空间 create temporary tablespace mytemp tempfile '/u01/app/oracle/oradata/orcl/my_temp.dbf' size 100m
create user tester2 identified by abc123 default tablespace mytbs2 temporary tablespace mytemp;
rowid
64进制 a-z 26 A-Z 26 0-9 10 62ide
rowid能够分析出这条记录在磁盘上的具体位置
rowid和rownum是不存在的字段,是实时计算的,因此咱们也把这两个字段叫作伪列。spa
rownum会自动给你所获得的记录进行数字编号,从1开始。咱们常常用rownum来分页。code
select rownum,a.* from tbl_student a where rownum>=4
大于运算:仅当全部的数据均大于等于4时,数据方能取出
小于运算正常it
rownum仅仅支持小于运算,不支持大于运算table
create table tbl_student( stu_no char(4) primary key, stu_name varchar2(30) not null, stu_mark int not null ); insert into tbl_student values('0010','mary',89); insert into tbl_student values('0016','david',67); insert into tbl_student values('0009','jenny',90); insert into tbl_student values('0001','mike',76); insert into tbl_student values('0190','王有财',83); insert into tbl_student values('0234','刘涛',34); insert into tbl_student values('0011','王七',56); insert into tbl_student values('0018','刘武',59); insert into tbl_student values('0191','王有财1',63); insert into tbl_student values('0235','刘涛1',39); insert into tbl_student values('0015','王七1',58); insert into tbl_student values('0118','刘武1',79);
select rownum,a.* from tbl_student a; //取不出任何数据 select rownum,a.* from tbl_student a where rownum>=4 and rownum<=6; //效率低下 select * from ( select rownum rn,a.* from tbl_student a ) where rn>=4 and rn<=6 //能够取出数据 select * from ( select rownum rn,a.* from tbl_student a where rownum<=6 ) where rn>=4 select * from ( select rownum rn, a.* from ( select * from tbl_student order by stu_mark ) a where rownum<=6 ) where rn>=4 //ORACLE分页公式 select * from ( select rownum rn, a.* from (SQL CLAUSE) a where rownum<=:endScope ) where rn>=:beginScope