oracle系列(三)表操作基礎

來源:互聯網
上載者:User

標籤:clob   --   ble   int   add   trunc   結構   使用   檔案路徑   

支援的資料類型:

字元型
char定長最大2000
varchar2()變長最大4000
clob字元型大對象 最大4G

數字型
number範圍 -10的38次方到10的+38次方;
number(5,2)一個小數,有效位5個,小數點後2個數字
number(5)表示一個5位的整數

日期類型
date
timestamp

位元據
blob 保密性較高,存入資料庫/其他情況,保持在檔案伺服器,資料庫只存檔案路徑

建表:

create table student(
stuId varchar2(10),
age number(2),
birthday date
)

--添加一個欄位
alter table student add(name varchar2(10));
--修改欄位長度
alter table student modify (name varchar2(20));

null值:is null , is not null
select * from student t where t.name is not null;

savepoint 儲存點的使用

SQL> savepoint firstPoint;
Savepoint created

delete from student;

rollback to firstPoint;

drop from student;
delete from student where age>10;
truncate table student;--刪除所有記錄,表結構還在,不寫日誌,速度極快

簡單查詢:

列別名,函數nvl
select t.age "年齡" ,nvl( t.age,0) "年齡為null顯示0",t.rowid from STUDENT t;
字串串連:||
select t.name||‘-‘|| t.age from student t;

like操作符:
%:任意0到多個字元
_:單個任一字元

 

oracle系列(三)表操作基礎

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.