资源描述:
《数据库的创建与管理实验报告》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、实验题目数据库的创建与管理小组合作否姓名班级学号一、实验目的(1)掌握创建、修改与删除表的两种方法。(2)掌握创建与删除索引的两种方法。(3)掌握利用企业管理器向表中插入记录的方法二.实验环境SQLSever2000及相关的硬件设备。三、实验内容与步骤(1)利用企业管理器创建学生表Student,表结构如下表所示:学生表Student的结构列名数据类型宽度小数位空否备注Snochar9N学号,主码Snamechar8Y姓名Ssexchar2Y性别SageintY年龄Sdeptchar20Y系别(2)使用T-SQL语句创建课程表Cours
2、e和选课表SC,表结构如下表所示:课程表Course的结构列名数据类型宽度小数位空否备注Cnochar4N课程号,主码Cnamechar40Y课程名Cpnochar4Y先修课程号,外码CcreditintY学分选修课SC的结构列名数据类型宽度小数位空否备注Snochar9N学号,外码合为主码Cnochar4N课程号,外码GradeintY成绩(3)使用T-SQL语句修改Student表的结构:将姓名改为6位定长字符串、新增入学时间列、新增姓名取唯一值的约束条件、删除入学时间列。(4)使用T-SQL语句为Student表,按Sdept列建
3、立一个聚簇索引,为SC表按学号升序和课程号降序建立唯一索引。he"governingforthepeople","Nomattertheinterestsofthemasses"conceptunderstandingisnotinplace.Thespecificworktreatswiththedeployment,afewleadingcadrescomplainthatworkistoocomplicated,toomuchresponsibility,thepressureistoolarge,toomuchemphasiso
4、nthedifficultyofthework.Forexample,noncoalmine(5)利用企业管理器分别向学生表Student、课程表Course和选课表SC添加如下表所示的数据。学生表Student的内容SnoSnameSsexSageSdept200215121李勇男20CS200215122刘晨女19CS200215123王敏女18MA200215125张立男19IS课程表Course的内容CnoCnameCpnoCcredit1数据库542数学23信息_系统144操作_系统635数据结构746数据处理27PASCAL
5、语言64选课表SC的内容SnoCnoGrade200215121192200215121285200215121388200215122290200215122380四、实验过程与分析1、利用企业管理器创建学生表Studenthe"governingforthepeople","Nomattertheinterestsofthemasses"conceptunderstandingisnotinplace.Thespecificworktreatswiththedeployment,afewleadingcadrescomplainth
6、atworkistoocomplicated,toomuchresponsibility,thepressureistoolarge,toomuchemphasisonthedifficultyofthework.Forexample,noncoalmine使用T-SQL语句创建课程表Course和选课表SCCREATETABLECourse(Cnochar(4)primarykeyNOTNULL,Cnamechar(40),Cpnochar(4),Ccreditint,foreignkey(Cpno)referencesCourse(
7、Cno));createtableSC(Snochar(9)notnull,Cnochar(4)notnull,Gradeint,primarykey(Sno,Cno),foreignkey(Sno)referencesStudent(Sno),foreignkey(Cno)referencesCourse(Cno));he"governingforthepeople","Nomattertheinterestsofthemasses"conceptunderstandingisnotinplace.Thespecificworktre
8、atswiththedeployment,afewleadingcadrescomplainthatworkistoocomplicated,toomuchresponsibility,thepressur