门诊部数据库脚本设计脚本设计.pdf

门诊部数据库脚本设计脚本设计.pdf

ID:51489859

大小:86.08 KB

页数:12页

时间:2020-03-25

门诊部数据库脚本设计脚本设计.pdf_第1页
门诊部数据库脚本设计脚本设计.pdf_第2页
门诊部数据库脚本设计脚本设计.pdf_第3页
门诊部数据库脚本设计脚本设计.pdf_第4页
门诊部数据库脚本设计脚本设计.pdf_第5页
资源描述:

《门诊部数据库脚本设计脚本设计.pdf》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、门诊部数据库脚本设计-------------------------------------数据库初始化----------------------------setnocountonsetdateformatymdgoifexists(select*fromsysdatabaseswherename='hospital')dropdatabasehospitalgo-------------------------------------数据库的建立-------------------------

2、---createdatabasehospitalonprimary(name='hospital_data',filename='e:hospital.mdf',size=1,maxsize=5,filegrowth=1)logon(name='hospital_log',filename='e:hospital.ldf',size=1,maxsize=5,filegrowth=1)go--------------------------------------表的建立--------------

3、---------------------usehospitalgoifexists(select*fromsysobjectswherename='patient')droptabledbo.patientgoprint'droptablepatient'print'createpatient'go/*病人表*/createtablepatient(pat_nochar(10)notnull,----病人编号pat_namechar(10)notnull,----病人姓名ageintnotnull,-

4、---年龄sexchar(1)notnull----性别check(sexin('m','f')),allermedchar(15)null,----过敏药物primarykey(pat_no))----创建主键goinsertintodbo.patientvalues('0000000001','李红',28,'f','青霉素')insertintodbo.patientvalues('0000000002','张三',48,'m','青霉素')insertintodbo.patientvalues(

5、'0000000003','李四',21,'f','红霉素')insertintodbo.patientvalues('0000000004','田荣星',15,'f','红霉素')insertintodbo.patientvalues('0000000005','张大嘴',67,'m','红霉素')insertintodbo.patientvalues('0000000006','李霞',28,'f','红霉素')go------------------------------------------

6、----------------------------------ifexists(select*fromsysobjectswherename='doctor')droptabledbo.doctorgoprint'droptabledoctor'print'createdoctor'go/*医生表*/createtabledoctor(doc_nochar(5)notnull----医生编号check(doc_nolike'[d][0-9][0-9][0-9][0-9]'),doc_namecha

7、r(10)notnull,----医生姓名ageintnotnull,----年龄sexchar(1)notnull----性别check(sexin('m','f')),deptchar(10)notnull,----所属部门titlechar(10)notnull,----职称datehireddatetimenull,----工作日期primarykey(doc_no))----创建主键goinsertintodbo.doctorvalues('d0001','刘查理',48,'m','耳喉科',

8、'科长','1979/10/26')insertintodbo.doctorvalues('d0002','张学明',33,'m','耳喉科','主任','1986/1/20')insertintodbo.doctorvalues('d0003','赵洪亮',52,'m','妇科','科长','1970/5/16')insertintodbo.doctorvalues('d0004','尤大梅',28,'f','妇科','委员','1998

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。