练习**SQLServer编程结构createdatabaseStudent_infoonprimary( name='Student_info', filename='F:\sql\', size=10mb, maxsize=200mb, filegrowth=10%)logon( name='Student_info_log', filename='F:\sql\', size=5mb, maxsize=20mb, filegrowth=10%)*创建表Student列名称类型宽度允许空值缺省值约束主键说明Snochar8否是学号Snamevarchar8否学生姓名Sexchar2否男性别Birthsmalldatetime否出生年月Classnochar3否班级号Entrance_datesmalldatetime否入学时间Home_addrvarchar40是家庭地址Sdeptvarchar20否所在系Postcodechar6是邮政编码*创建表StudentcreatetableStudent( Snochar(8)notnullprimarykey, Snamevarchar(8)notnull, Sexchar(2)notnulldefault('男'), Birthsmalldatetimenotnull, Classnochar(3)notnull, Enterce_datesmalldatetimenotnull, Home_addrvarchar(40), Sdeptvarchar(20)notnull, check(Enterce_date>Birth))*创建表StudentaltertableStudentaddPostcodechar(6)check(Postcodelike'[0-9][0-9][0-9][0-9][0-9][0-9]')*amevarchar20否课程名称Total_periorsmallint是大于0总学时Credittinyint是大于0,小于等于6学分*创建表CoursecreatetableCourse( Cnochar(3)notnullprimarykey, Cnamevarchar(20)notnull, Total_periorsmallint, Credittinyint, check(Total_perior>0andCredit>0andCredit<=6))*ochar3否是课程号Gradetinyint是大于等于0,小于等于100否成绩*reatetableSC( Snochar(8)notnull, Cnochar(3)notnull, Gradetinyint, primarykey(o), foreignkey(sno)referencesStudent(Sno), o)o))*
数据库练习题ppt课件 来自淘豆网m.daumloan.com转载请标明出处.