📄 products.sql
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -