Question: Write an SQL script to create the following tables: purchase --that contains a serial id for the purchase a date for the purchase. (you can

Write an SQL script to create the following tables:

purchase --that contains a serial id for the purchase a date for the purchase. (you can make it timestamp and give it the default of current_timestamp), the id of the supplier as a foreign key and the id of the employee making the purchase as a foreign key.

purchasedetail--that will have a purchasedetailid as a primary key, purchaseid as a foreign key, item description as text, units as text, quantity and purchase price.

sale--which will have the saleid as primary key, employeeid and memberid as foreign keys, and saledate which can also be a timestamp with a defaulr of current_timestamp.

saledetail--which will have a saledetailid as primary key, saleid as a foreign key, inventoryid as a foreign key, quantity and discount. (Discount should be numeric. You can give it a default of 0 if you wish)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!