Create Primary Keys on all 3 tables All 3 tables should have IDENTITY columns as the PRIMARY
Question:
Create Primary Keys on all 3 tables
All 3 tables should have IDENTITY columns as the PRIMARY KEY's. They must start at 100 and increment by 2.
Create a Unique Key on dbo.Sales.VerficationCode
Create a relationship between the Customer / SalesRep& the Sales Table
No nulls will be allowed in the following tables. Columns
dbo.Sales.SalesDate
dbo.Sales.VerificationCode
The following tables.columns will default to GetDate() if no Date is given.
Dbo.Customer.EntryDate
Dbo.SalesRep.HireDate
Dbo.Sales.SalesDate
dbo.Sales.UnitCount should not allow NULLS or Zero's
Run the following script to ensure the Constraints have been added correctly
INSERTINTO dbo.Customer(CustName)
SELECT'Ali'UNION
SELECT'Anand'UNION
SELECT'Alex'UNION
SELECT'Jack'UNION
SELECT'Nina'UNION
SELECT'Joel'UNION
SELECT'Keon'UNION
SELECT'James'UNION
SELECT'Mike'UNION
SELECT'Sai'UNION
SELECT'Terry'
INSERTINTO dbo.SalesReps(RepName)
SELECT'Joseph'UNION
SELECT'Jermaine'UNION
SELECT'Marshall'UNION
SELECT'Marvin'UNION
SELECT'Mitchell'UNION
SELECT'Johnson'UNION
SELECT'Robert'UNION
SELECT'Rachel'UNION
SELECT'Rene'UNION
SELECT'Brandy'UNION
SELECT'Dirk'
INSERTINTO dbo.Sales(CustID, RepID,UnitCount,VerificationCode)
SELECT 100,120,1,'Ver01'UNION
SELECT 102,118,2,'Ver02'UNION
SELECT 104,116,3,'Ver03'UNION
SELECT 106,114,4,'Ver04'UNION
SELECT 108,112,5,'Ver05'UNION
SELECT 110,110,1,'Ver06'UNION
SELECT 112,108,2,'Ver07'UNION
SELECT 114,106,3,'Ver08'UNION
SELECT 116,104,4,'Ver09'UNION
SELECT 118,102,5,'Ver10'UNION
SELECT 120,100,6,'Ver11'