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

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'
dbo.Customer Columns CustID (int, null) CustName (varchar(50), null) EntryDate (datetime, null) dbo.SalesReps Columns RepID (int, null) RepName (varchar(50), null) HireDate (datetime, null) dbo.Sales Columns SalesID (int, null) CustID (int, null) RepID (int, null) SalesDate (datetime, null) 

dbo.Customer Columns CustID (int, null) CustName (varchar(50), null) EntryDate (datetime, null)

Step by Step Solution

3.40 Rating (147 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

From your question it seems like you want to alter existing database tables to add primary keys unique constraints and default values and also to ensure not null constraints are enforced on specific c... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!