Home > Database > Mysql Tutorial > ACCESS中用SQL语句创建表,修改,删除表

ACCESS中用SQL语句创建表,修改,删除表

WBOY
Release: 2016-06-07 15:50:10
Original
2288 people have browsed it

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 tab

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 ([约束字段]
删除约束:Alter TABLE [表名] Drop CONSTRAINT 约束名

新建默认值:Alter TABLE [表名] ADD CONSTRAINT 默认值名 DEFAULT 'Gziu.CoM' FOR [字段名]

删除默认值:Alter TABLE [表名] Drop CONSTRAINT 默认值名

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template