我正在尝试在 SQL Server 2012 Management Studio 中创建一个表。
我想创建一个包含列的表:category
、customer
、Costume
、Payment
和rental
。
这是我到目前为止的SQL:
CREATE TABLE dbo.CATEGORY
(
CATEGORY_ID CHAR(5) PRIMARY KEY,
CATEGORY_DESC CHAR(50) NOT NULL
);
CREATE TABLE dbo.COSTUME
(
Costume_ID CHAR(5),
Costume_Desc CHAR(50),
Costume_Size CHAR(5),
Costume_RentalPricE DECIMAL(12,2),
Category_ID CHAR(5)
);
CREATE TABLE dbo.CUSTOMER
(
Customer_ID CHAR(5),
Customer_LastName CHAR(50),
Customer_FirstName CHAR(50),
Customer_Address CHAR(30),
Customer_City CHAR(50),
Customer_State CHAR(2),
Customer_Zip CHAR(10),
Customer_Phone CHAR(10),
Category_ID CHAR(5)
);
CREATE TABLE dbo.Payment
(
Payment_ID CHAR(5),
Customer_ID CHAR(5),
Payment_Date DATE,
Payment_Amount DECIMAL(12,2),
Payment_Comment VARCHAR,
);
CREATE TABLE dbo.Rental
(
Rental_ID --it says this needs to be Long integer for field size?
Customer_ID CHAR(5),
Costume_ID CHAR(5),
Rental_Date DATE,
Rental_DueDate DATE,
Rental_CheckIn --YES OR NO? i'M NOT SURE HOW TO DO THIS.
Rental_Penalty DECIMAL(12,2)
);
如何创建布尔列和长字段?