商品进销存管理系统数据库DB_Goods
表 T_Type:商品类别表
表 T_Goods商品表
表 T_Provider供应商表
表 T_Customer客户表
表 T_Stock库存表(入库,出库在此表上操作)
create database DB_Goods
go
use DB_Goods
go
CREATE TABLE T_Type
(
typeId smallint primary key NOT NULL,
typeName varchar(40) NOT NULL,
typeDescription char(500) NULL
)
go
go
CREATE TABLE T_Provider
(
providerId int primary key NOT NULL,
providerName varchar(50) NOT NULL,
providerAddress varchar(50) NOT NULL,
providerContractName varchar(50) NOT NULL,
providerPhone int NOT NULL,
providerFaxNumber varchar(50)
)
go
CREATE TABLE T_Goods
(
goodsId int primary key NOT NULL,
goodsName varchar(50) NOT NULL,
goodsTypeId smallint constraint GK_T_Type_T_Goods references T_Type NOT NULL,
goodsInPrice int NOT NULL,
goodsOutPrice int NOT NULL,
providerId int constraint FK_T_Provider_T_Goods references T_Provider NOT NULL,
providerName varchar(50) NOT NULL
)
go
CREATE TABLE T_Customer
(
customerId int primary key NOT NULL,
customerName varchar(50) NOT NULL,
customerAddress varchar(50) NOT NULL,
customerPostalCode int NULL,
customerEmail varchar(50) NOT NULL,
customerPhone varchar(50) NULL,
customerMobilePhone varchar(50) NOT NULL,
memo char(500) NULL
)
go
CREATE TABLE T_Stock
(
goodsId int NOT NULL,
goodsName varchar(50) NOT NULL,
goodsNumber int NOT NULL,
goodsInDate datetime NOT NULL,
providerId int constraint FK_T_Provider_T_Stock references T_Provider NOT NULL,
providerName varchar(50) NULL,
customerId int constraint FK_T_Customer_T_Stock references T_Customer NOT NULL,
customerName varchar(50) NULL
)
Go