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
Get step-by-step solutions from verified subject matter experts
