-- College Park Auto-Parts --

USE CollegeParkAutoParts1;
GO
CREATE SCHEMA Inventory;
GO
CREATE SCHEMA Transactions;
GO
CREATE TABLE Inventory.AutoParts
(
	PartNumber int NOT NULL,
	CarYear    int, 
	Make       nvarchar(50),
	Model      nvarchar(50),
	Category   nvarchar(50),
	PartName   nvarchar(100),
	UnitPrice  money,
	CONSTRAINT PK_AutoParts PRIMARY KEY (PartNumber)
);
GO
CREATE TABLE Transactions.CustomersOrders
(
	ReceiptNumber int NOT NULL,
	PartsTotal    money,
	TaxRate       decimal(6, 2),
	TaxAmount     money,
	OrderTotal    money,
	CONSTRAINT PK_CustomersOrderts PRIMARY KEY (ReceiptNumber)
);
GO
CREATE TABLE Transactions.PartsSold
(
	PartsSoldID     int identity(1, 1) NOT NULL,
	ReceiptNumber   int NOT NULL,
	PartNumber      int NULL,
	PartName        nvarchar(100),
	UnitPrice       money,
	Quantity        int,
	SubTotal        money,
	CONSTRAINT PK_PartsSold PRIMARY KEY (PartsSoldID)
);
GO