products.sql
来自「用Delphi编写的生产管理系统源码」· SQL 代码 · 共 45 行
SQL
45 行
CREATE TABLE Products
(
ProductID int IDENTITY (1,1) NOT NULL,
ProductName nvarchar (40) NOT NULL,
SupplierID int,
CategoryID int,
QuantityPerUnit nvarchar (20),
UnitPrice money
DEFAULT (0),
UnitsInStock smallint
DEFAULT (0),
UnitsOnOrder smallint
DEFAULT (0),
ReorderLevel smallint
DEFAULT (0),
Discontinued bit NOT NULL
DEFAULT (0),
PRIMARY KEY CLUSTERED (ProductID) ON PRIMARY,
FOREIGN KEY (SupplierID)
REFERENCES Suppliers (SupplierID),
FOREIGN KEY (CategoryID)
REFERENCES Categories (CategoryID),
CHECK ([UnitPrice] >= 0),
CHECK ([UnitsInStock] >= 0),
CHECK ([UnitsOnOrder] >= 0),
CHECK ([ReorderLevel] >= 0)
)
go
CREATE INDEX CategoryID
ON Products (CategoryID)
ON PRIMARY
go
CREATE INDEX ProductName
ON Products (ProductName)
ON PRIMARY
go
CREATE INDEX SupplierID
ON Products (SupplierID)
ON PRIMARY
go
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?