CREATE TABLE [dbo].[teacher]
(
[teacher_id] [tinyint] IDENTITY(1,1) NOT NULL,
[teacher_name] [nvarchar](max) NOT NULL DEFAULT (N'无'),
[gender] [nvarchar](max) NOT NULL DEFAULT (N'无'),
[birthday] [date] DEFAULT (N'1990-01-01'),
[address] [nvarchar](max) DEFAULT (N'无'),
[idnumber] [nvarchar](max) DEFAULT (N'无'),
[class_id] [int] not null ,
PRIMARY KEY ([teacher_id]),
CHECK ([gender]=N'男' OR [gender]=N'女' OR [gender]=N'无')
)
//===========================================================
//===========================================================
CREATE TABLE [dbo].[表名]
(
[teacher_id] [tinyint] IDENTITY(1,1) NOT NULL, //自增长从1开始每次增加1
[teacher_name] [nvarchar](max) NOT NULL DEFAULT (N'无'),//字段长度给最大
[gender] [nvarchar](max) NOT NULL DEFAULT (N'无'),
[birthday] [date] DEFAULT (N'1990-01-01'),
[address] [nvarchar](max) DEFAULT (N'无'),
[idnumber] [nvarchar](max) DEFAULT (N'无'),
[class_id] [int] not null ,
PRIMARY KEY ([teacher_id]),//设置主键
CHECK ([gender]=N'男' OR [gender]=N'女' OR [gender]=N'无')
)
|