不知道这么解决、、、
create database [hdu] on ( name = hdu, filename = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\hdu.mdf' , size = 4 , maxsize = 100, filegrowth = 10% )
--表— use hdu create table Class ( Clno Char(5)not null primary key , Speciality VarChar(20) not null, Iyear Char(4) not null, Number Integer check(Number>1 and Number<300), Monitor Char(7) ) --1.Student 表-- create table Student ( Sno Char(7) primary key, Sname VarChar(20) not null , Ssex Char(2) not null check(Ssex='男' or Ssex='女' ) default '男', Sage Smallint check(Sage>14 and Sage<65), Clno Char(5) not null foreign key references Class(Clno) )
insert into Class values ('00311','计算机软件','2000','120','2000101') insert into Class values ('00312','计算机应用','2000','140','2000103') insert into Class values ('01311','计算机软件','2001','220','2001103') go select * from Class
相忘于江湖494
媛猿
相关分类