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 student
add phone char(20) not null
go
删除列
alter table student
drop column phone
go
修改表名
exec sp_rename'student','student01'
删除表
drop table student01