日期類型
date 包含年月日和時分秒
timestamp 這是Oracle9i對date資料類型的擴充 (時間戳記)date類型的時間更精確
圖片類型
blob 位元據可以存放圖片 和聲音 4G
oracle表的管理
建立表一個student表的語句
create table student(
xh number(4),
xm varchar2(20),
sex char(2),
birthday date,
sal number(7,2)
);
建立表一個Tclass表的語句
create table Tclass(
class_id number(2),
cName varchar2(20)
);
修改表
在Student表中添加一個欄位class_id
alter table student add(class_id number(2));
在Student表中修改一個欄位xm
alter table student modify (xm varchar2(30))
在Student表中刪除一個欄位xm
alter table student drop column xm;
怎樣改oracle中的預設日期(因為在oracle中日期預設為 "日月年")
alter session set nls_date_format='yy-mm-dd'
使用is 關鍵字查詢null值
select * from student where birthday is null;
使用like關鍵字
select * from student where xh like '%3%';
更新student表中xh=1234的birthday為 null值
update student set birthday = null where xh = 1234
刪除資料
delete from student;
oracle 支援交易回復
設定 一個點 savepoint a ;
執行 delete from student 語句 刪除表中的所有資料
然後回到 我們設定的點a
執行的語句 :rollback to a ;
執行完後我們在去查詢資料表的資料 將會 回到刪除前的狀態。
使用truncate 刪除表 表的結構還在, 不寫日誌,無法找回刪除的記錄 , 但速度快。
執行語句:truncate table student
使用delete 刪除表
使用delete刪除會將表的結構刪除 這張表將不會存在。