Oracle建表,修改字段,建序列等語句

2022-09-04 02:06:06 字數 936 閱讀 9767

建表:

create

table

tb_user (

id

intnot

null

, username

varchar(32) not

null

, password

varchar(32) not

null

, phone

varchar(32) not

null,

primary

key(id)

)

建立序列:

create sequence seq_user start with

1 increment by1;

從1開始,每次加1

select seq_module.nextval from

dual

//查詢下乙個id值

alter

table tb_user rename column username to

username;

//修改表中欄位名稱

alter

table tb_user modify (id varchar2(20

));//修改表中某一欄位資料型別

alter

table tb_user add (job varchar2(20) default

'預設值

'not

null

);//增加乙個欄位job 資料型別 預設值 不為空

alter

table tb_user drop

(job);

//刪除表中某一欄位

Oracle 建表 約束 修改列

增加列 alter table name add columnname type 或者alter table name add columnname type 修改列名 alter table name rename column name1 to name2 刪除列alter table name...

oracle建表 建表空間語句

oracle建立表空間是我們經常會用到的操作,下面就為您詳細介紹oracle建立表空間的語句寫法,希望對您學習oracle建立表空間能有所幫助。建立臨時表空間 create temporary tablespace test temp tempfile e oracle product 10.2.0...

Oracle的使用 建庫建表

create table student sid number 20 sname varchar2 10 新增一列 alter table student add gender number 1 修改列型別 varchar2 是可變長度型別 char是固定長度 alter table student...