SQL语句创建表并添加数据

来源:互联网 发布:网络安全法的特征 编辑:程序博客网 时间:2024/05/16 07:35

SQL语句创建表并添加数据

创建表

use school 指定要用的数据库go  create table student 创建表(ID bigint identity(1,1), 添加ID,identity(标识种子,递增量)name varchar(10) not null, 添加姓名sex char(2) not null, 添加性别age int  not null,添加年龄)go 执行

修改表列属性

alter table student 指定修改的表名alter column name char(20) null 修改name的数据长度go 执行

增加列

alter table studentadd phone char(20) not null go

删除列

alter table studentdrop column phonego

修改表名

exec sp_rename'student','student01'

删除表

drop table student01
0 0
原创粉丝点击