资源描述:
《医药销售管理系统sql语句》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、createdatabaseMedicalManagerSystem/*创建医药销售管理系统*/useMedicalManagerSystemcreatetableMedID/*创建药品类别索引信息*/(MedKindeCodechar(10)constraintMI_PRIPRIMARYKEY,KindExplanationvarchar(12)NOTNULL)createtableMedInfor/*创建药品信息表*/(MedicineCodechar(6)constraintM_PRIMPRIMARYKEY,MedicineNamevar
2、char(8)NOTNULL,MedKindeCodechar(10)FOREIGNKEYREFERENCESMedID(MedKindeCode),PriceMoney,ListPriceMoney,NumberInt,FirmCodechar(10)FOREIGNKEYREFERENCESFirmInfor(FirmCode),UserfulllifeDatetime)createtableGueInfor/*创建客户信息表*/(GuestCodechar(10)constraintG_PRIMPRIMARYKEY,GuestNamevar
3、char(16)NOTNULl,GLinkvarchar(12),GLinkTellvarchar(11),Cityvarchar(8))createtableFirmInfor/*创建供应商信息表*/(FirmCodechar(10)constraintF_PRIMPRIMARYKEY,FirmNamevarchar(16)NOTNULL,Linkvarchar(12),LinkTellvarchar(11),Cityvarchar(8))createtableWorkInfor/*创建员工信息表*/(WorkNochar(10)constr
4、aintW_PRIMPRIMARYKEY,Namevarchar(12),UserRegNamechar(6)NOTNULL,Passwordchar(10)NOTNULL,Positionchar(10),PowerInt)createtablesellMain/*创建医药销售主表*/(SaleNointconstraintSM_PRIMPRIMARYKEY,WorkNochar(10)FOREIGNKEYREFERENCESWorkInfor(WorkNo),SaleDateDateTime,AmountMoney)createtables
5、ellChild/*创建医药销售子表*/(SaleNointconstraintSC_PRIMPRIMARYKEY,MedicineCodechar(6)FOREIGNKEYREFERENCESMedInfor(MedicineCode),MedicineNamevarchar(32)NOTNULL,PriceMoney,NumberInt,Uintchar(8),AmountMoney)/*插入数据的存储过程*/createprocMedID_proc@MedKindeCodechar(10),@KindExplanationvarchar(
6、12)asinsertintoMedID(MedKindeCode,KindExplanation)values(@MedKindeCode,@KindExplanation)execMedID_proc'0001','口腔溃疡'execMedID_proc'0002','感冒'execMedID_proc'0003','发烧'execMedID_proc'0004','拉肚子'execMedID_proc'0005','外伤'createprocMedInfor_proc@MedicineCodechar(6),@MedicineNameva
7、rchar(8),@MedKindeCodechar(10),@Pricemoney,@ListPricemoney,@Numberint,@FirmCodechar(10),@UserfulllifeDatetimeasinsertintoMedInfor(MedicineCode,MedicineName,MedKindeCode,Price,ListPrice,Number,Supplicer,Userfulllife)values(@MedicineCode,@MedicineName,@MedKindeCode,@Price,@Lis
8、tPrice,@Number,@FirmCode,@Userfulllife)execMedInfor_proc'1001','板蓝根','0002'