《数据库》SchoolInfo数据库脚本.doc

上传人(卖家):momomo 文档编号:5897794 上传时间:2023-05-14 格式:DOC 页数:3 大小:37.50KB
下载 相关 举报
《数据库》SchoolInfo数据库脚本.doc_第1页
第1页 / 共3页
《数据库》SchoolInfo数据库脚本.doc_第2页
第2页 / 共3页
《数据库》SchoolInfo数据库脚本.doc_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

1、CREATE DATABASE SchoolInfo -创建数据库-创建Department表Create table Department(DepID int primary key,DepName varchar(20) NOT NULL, Total int)-创建Course表Create table Course(CourseID int primary key,CourseName varchar(20) not null, Credit int)-创建学生表Create table Student(StuID char(10) constraint pkStuID primary

2、 key constraint chkStuID check(StuID like A,B,Z0-90-90-90-90-9) ,StuName varchar(20) not null,StuAge int constraint chkStuAge check(StuAge between 15 and 100) ,StuSex char(2) constraint chkStuSex check(StuSex in(男,女) constraint defStuSex default 男,StuCity varchar(20) ,StuScore float constraint chkSt

3、uScore check(StuScore between 0 and 100) ,DepID int constraint fkDepID foreign key references Department(DepID)-创建SC表Create table SC(StuID char(10) constraint fkStuID foreign key references Student(StuID) ,CourseID int constraint fkCourseID foreign key references Course(CourseID) Constraint pkStuCou

4、rse primary key(StuID,CourseID) , Score float constraint chkScore check(Score between 0 and 100)create table Teacher(TeaID char(10) primary key,TeaName varchar(20),TeaTitle varchar(20),CourseNum int )create table Salary(TeaID char(10) constraint fkTeaID foreign key references Teacher(TeaID) constrai

5、nt pkTeaID primary key,Wage money)CREATE TABLE Employee(EmpID char(10) primary key,EmpName varchar(20) NOT NULL,EmpBirthDate datetime)-插入记录insert into department values(1,computer,95)insert into department values(2,math,100)insert into student values(A00001,Tom,19,男,南京市,95,1)insert into student valu

6、es(A00002,Jack,21,男,上海市,88,2)insert into student values(A00003,Nancy,23,女,北京市,70,1)insert into student values(A00004,Droa,21,女,南京市,92,2)insert into student values(A00005,Jerome,24,男,上海市,77,1)insert into student values(A00006,Andy,18,女,北京市,80,2)insert into course values(1,database,3)insert into cours

7、e values(2,math,4)insert into course values(3,english,4)insert into SC values(A00001,1,90)insert into SC values(A00001,2,85)insert into SC values(A00001,3,90)insert into SC values(A00002,1,90)insert into SC values(A00003,2,80)insert into SC values(A00004,3,85)insert into SC values(A00005,1,90)insert into Teacher values(T0001,Mary,讲师,50)insert into Teacher values(T0002,Tom,教授,40)insert into Teacher values(T0003,Mike,副教授,40)insert into Employee values(E001,Mary,1996-01-01)insert into Employee values(E002,Tom,1994-03-01)insert into Employee values(E003,Jack,1995-01-01)

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 大学
版权提示 | 免责声明

1,本文(《数据库》SchoolInfo数据库脚本.doc)为本站会员(momomo)主动上传,163文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。
2,用户下载本文档,所消耗的文币(积分)将全额增加到上传者的账号。
3, 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(发送邮件至3464097650@qq.com或直接QQ联系客服),我们立即给予删除!


侵权处理QQ:3464097650--上传资料QQ:3464097650

【声明】本站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是网络空间服务平台,本站所有原创文档下载所得归上传人所有,如您发现上传作品侵犯了您的版权,请立刻联系我们并提供证据,我们将在3个工作日内予以改正。


163文库-Www.163Wenku.Com |网站地图|