Foreign key instances established by the SQL Server2000 command

xiaoxiao2021-03-30  224

create database zhouhuigouse zhouhuigocreate table customer (customerID int primary key, customerName varchar (50) not null, address varchar (100) null, linkMan char (20) null, tel char (20) null, fax char (20) null, zipCode char (10) NULL, CUSTOMERREMARK TEXT NULL) GO

Create Table Feeder / * Supplies Information Table * / (Feederid Int Not Null Primary Key, / * Supplies Number (Main Key) * / Address VARCHAR (100) NULL, / * Unit Address * / Linkman Char (20) NULL , / * Contact NAC, / * Contact phone * / Fax Char (20) NULL, / * Fax Number * / Zipcode Char (10) NULL, / * Postal Code * / FeederRemark Text Null , / * Remark information * /) GO

/ * Establish an inventory information Data table * / create Table Storage / * Inventory Information Data Table * / (StorageId Int Not Null Primary Key, / * Inventory Information Number (Main Key) * / / * Foreign Key Productid References Product (ProductID), / * Good item number (foreign key) * / * / depotname varchar (50) Not null, / * Warehouse name * / productname varchar (50) Not null, / * Goods Name * / Spec varchar (50) NULL, / * Goods Specifications * / Unit varchar (50) null, / * Metrology unit * /)

/ * Establish a library information data table * / create Table Sell / * Outbound Information Data Table * / (Sellid Int Not Null Primary Key, / * Outline Information Number (Profile) * / / * Foreign Key ProductId References Product (ProductID) ), / * Goods number (foreign bond) * / * / customername varchar (50) Not null, / * receiving unit name * / depotname varchar (50) Not null, / * Warehouse Name * / ProductName VARCHAR NOT NULL, / * Product Name * / Quantity Float Not Null, / * Number of goods * / Unitprice Float Not Null, / * Goods Price * / Payment Float Null, / * Total Payment * / SELLDATE DATETIME NULL, / * Out Date * /

GO / * establishment information data sheet * / create table stock / * inviting information data table * / (stockid int not null primary key, / * inviting information number (primary key) * / / * Foreign Key ProductId References Product ( ProductID, / * Goods Numbered (Outside "* / * / feedername varchar (50) Not null, / * Supplies Name * / DepotName Varchar (50) Not null, / * Warehouse Name * / ProductName Varchar (50) NOT NULL, / * Goods Name * / Quantity Float Not Null, / * Number of goods * / Unitprice Float Not Null, / * Goods Price * / Stockdate DateTime NULL, / * Introduction Date * / * Establish Warehouse Information Data Table * / create table depot / * Warehouse information table * / (depotid int not null primary key, / * warehouse number (primary key / automatic number) * / Depotname varchar not null, / * Warehouse Name * / Address varchar not null, / * Warehouse location * / principal varchar not null, / * Warehouse person in charge * /)

Create Table Product / * Goods Information Data Sheet * / (ProductID Int Not Null Primary Key, / * Goods Number (Primary Key / Auto Number) * / Customerid Int, / * Receiver No. (Outside) * / FeederID INT, / * Supply unit number (foreign key) * / storageID int, / * stock information number (foreign key) * / Depotid int, / * Warehouse number (foreign key) * / ProductName Varchar (50) Not null, / * Goods Name * / ProductClass Varchar (50) Not Null, / * Goods Category * / Productspec Varchar (50) Not NULL, / * Goods Specifications * / Unit Varchar (50) NULL, / * Meter Unit * / Minsto Float Not Null, / * Bottiter Stock / Maxsto Float Not Null / * High Line Inventory * / Foreign Key ([Customerid]) References [DBO]. [Customerid]), Foreign Key ([Feederid]) References [DBO]. [Feeder ] ([Feederid]), Foreign Key ([StorageID]) References [StorageId]), Foreign Key ([Depotid]) References [DepotID]))

转载请注明原文地址:https://www.9cbs.com/read-130573.html

New Post(0)