资源描述:
《数据库课程设计——医药销售管理系统》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、usemastergo--dropdatabaseMedicalManagerSystemcreatedatabaseMedicalManagerSystem/*创建医药销售管理系统*/on(name=M_data,filename='e:20094051227M_data.mdf',size=10MB,maxsize=300MB,filegrowth=10%)logon(name=M_log,filename='e:20094051227M_data.ldf',size=5MB,maxsize=300MB,filegrow
2、th=2MB)useMedicalManagerSystemgocreatetableFirmInfor/*创建供应商信息表*/(FirmCodechar(10)PRIMARYKEY,FirmNamevarchar(16)NOTNULL,Linkvarchar(12),/*联系人*/LinkTellvarchar(11),Cityvarchar(8));createtableMedInfor/*创建药品信息表*/(MedicineCodechar(6)PRIMARYKEY,MedicineNamevarchar(32)NOTNULL
3、,PriceMoney,ListPriceMoney,/*进价*/NumberInt,/*库存*/UserfulllifeDatetime,FirmCodechar(10),/*供应商,外键*/FOREIGNKEY(FirmCode)REFERENCESFirmInfor(FirmCode));createtableGueInfor/*创建客户信息表*/(GuestCodechar(10)PRIMARYKEY,GuestNamevarchar(16)NOTNULl,Gageint,GLinkTellvarchar(11));crea
4、tetableWorkInfor/*创建员工信息表*/(WorkNochar(10)PRIMARYKEY,Namevarchar(12),AgeInt,UserRegNamechar(6)NOTNULL,/*用户登录名*/Passwordchar(10)NOTNULL);/*密码*/createtableManagerInfor/*创建经理信息表*/(ManagerNamevarchar(12)PRIMARYKEY,UserRegNamechar(6)NOTNULL,PassWordchar(10)NOTNULL);createta
5、blesell/*创建医药销售表*/(SaleNointPRIMARYKEY,MedicineCodechar(6),WorkNochar(10),GuestCodechar(10),MedicineNamevarchar(32)NOTNULL,SaleDateDateTime,PriceMoney,NumberInt,FOREIGNKEY(GuestCode)REFERENCESGueInfor(GuestCode),FOREIGNKEY(MedicineCode)REFERENCESMedInfor(MedicineCode),
6、FOREIGNKEY(WorkNo)REFERENCESWorkInfor(WorkNo));createtableserve/*供应药品表*/(FirmCodechar(10)NOTNULL,MedicineCodechar(6)NOTNULL,ServedayDateTime,Servenumberint,PRIMARYKEY(FirmCode,MedicineCode),FOREIGNKEY(MedicineCode)REFERENCESMedInfor(MedicineCode),FOREIGNKEY(FirmCode)RE
7、FERENCESFirmInfor(FirmCode));/*插入数据*/insertintoFirmInfor(FirmCode,FirmName,Link,LinkTell,City)values('015','养生堂','小泰','681472','湖州');insertintoFirmInfor(FirmCode,FirmName,Link,LinkTell,City)values('014','宝芝林','张清','658421','德州');insertintoFirmInfor(FirmCode,FirmName,Li
8、nk,LinkTell,City)values('051','同仁堂','周丹','654217','北京');insertintoMedInforvalues('1001','板蓝根',5,3,'100','2010.12.5','