ACCESS中用SQL語句建立表,修改,刪除表

2021-06-09 20:53:19 字數 710 閱讀 6442

1.建立表 create table[t_test](id counter(1,1)  primary  key,u_name varchar(50),fatherid int)

id counter(1,1)  primary  key 設定id 為主鍵並自動增長

2.修改字段型別:

sql="alter table [表名] alter column 欄位名]   varchar(50)"

3.刪除表:

sql="drop table [表名]"

4.刪除字段:

sql="alter table [表名] drop [欄位名]"

5.修改字段:alter table [表名] alter column [欄位名] 型別(大小) null

6.新增字段:sql="alter table [表名] add column [欄位名] varchar(200)"

新建約束:alter table [表名] add constraint 約束名 check ([約束字段] <= '2007-1-1')

刪除約束:alter table [表名] drop constraint 約束名

新建預設值:alter table [表名] add constraint 預設值名 default 'gziu.com' for [欄位名]

刪除預設值:alter table [表名] drop constraint 預設值名

Oracle中用sql語句建立和管理表

create table schema.tablename column datatype default expr constaint desc tablename轉殖整個表 create table emp as select from scott.emp 轉殖表結構 create table ...

在ACCESS中用SQL匯入匯出資料

hkey local machine software microsofe jet 4.0 isam formats 下有多種格式,在access中可以使用這些格式匯入匯出 select into filname from text database e developer filname.txt ...

ACCESS中使用SQL語句

以下sql語句在access xp的查詢中測試通過 建表 create table tab1 id counter,name string,age integer,date datetime 技巧 自增字段用 counter 宣告.欄位名為關鍵字的字段用方括號括起來,數字作為欄位名也可行.建立索引 ...