创建表的完整实例:
user stuDB 调用stuDB数据库
go
if exists(select * from sysobjects where name='stuInfo') 判断数据库中是否存在stuInfo表
drop table stuInfo 如果有则删除
create table stuInfo 创建表
(
stuName varchar(20) not null, 学员姓名,数据类型varchar(20),非空
stuNo char(6) not null, 学号,数据类型char(6),非空
stuAge int not null, 年龄,数据类型int,非空
stuID numeric(18,0), 身份证号,数据类型numeric(18,0)
stuSeat smallint identity(1,1), 座位编号,数据类型smallint,标识列,从1开始递增
stuAddress text 住址,数据类型text
)
go 与下面的代码隔开