sql 语句 (一) 创建
create database Test
go
use Test
go
create table Tbclass
(
clsId int primary key identity(1,1),
clsName nvarchar(8) unique,
clsTeacher nvarchar(4),
clsNumber smallint check(clsNumber >= 20 and clsNumber <= 80)
)
go
create table Tbstudent
(
stuId int identity(1,1) primary key,
stuName nvarchar(4) not null,
stuNumber char(9) unique,
stuGender bit default(1),
stuAddress nvarchar(32),
stuAge smallint,
stuPhone char(11),
stuClassId int foreign key references Tbclass(clsId)
)
insert into Tbclass(clsName,clsNumber,clsTeacher)
values ('大数据班','65','张三')
select * from Tbclass