SQL2005 建立表的问题

来源:百度知道 编辑:UC知道 时间:2024/06/14 00:01:03
列名 数据类型 允许空 备注
T2C1 char(10) 否 主键
T2C2 char(10) 否
T2C3 char(6) 否 外键,参照引用T1表中的T1C1
T2C4 bit 是 默认值为true
T2C5 datetime 是 取值为1990年1月1日至2000年12月31日

其中T2C3 设为“外键,参照引用T1表中的T1C1” 怎么写
T2C4 设置默认值怎么设?

请具体写出来告诉我,谢谢您。

create table 表名
(T2C1 char(10) primary key,
T2C2 char(10) not null,
T2C3 char(6) not null,
T2C4 bit default ,
T2C5 datetime check(T2C5>1990-1-1andT2C5<2000-12-31),
foreign key ( t2c3) reference ti (t1c1)


主键天生是不能为空的