Untitled

 avatar
unknown
sqlserver
3 years ago
544 B
4
Indexable
create table Products(
ProductCode nvarchar(5),
Name nvarchar(30) not null,
Price float,
StockQuantity int,
constraint CK_Price float check (Price > 0),
constraint CK_SQ float check (StockQuantity >= 0)
)

create table OrderItems(
OrderID	nvarchar(10),
ProductCode	nvarchar(5),
Quantity int,		
Discount float,	
SellPrice float,
constraint CK_Quantity float check (Quantity >= 0)
constraint FK_oID foreign key (OrderID) references Orders(OrderID),
constraint FK_PC foreign key (ProductCode) references Products(ProductCode)
)
Editor is loading...