目錄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