Question: Please help with this SQL Question. I need the code for the purple text, please. Thank you in advance! QUESTION 23 Please read the below
Please help with this SQL Question. I need the code for the purple text, please. Thank you in advance!

QUESTION 23 Please read the below instructions carefully before attempting this Question: The answer to this question should be submitted in a sql file named in the format Midterm_FirstName_LastName.sql The answer queries should be written in chronological order according to the below questions You may use SQL Developer for building and testing the queries Your query should be written keeping in mind least possible memory space utilisation, better efficiency and coding conventions discussed in dass You will get 0 If your sql fille gives error while running in SQL developer, so test it before submitting The names highlighted in purple bold in the below questions should exactly match with your answer querles 1. Create a table inventory having the below columns. Also create a Primary key for this table by choosing the most suitable column: a. product_id: a numerical (precision - any length, scale =0) column b.product_name: a required column holding unique string values whose length must not exceed 100 c last_procured: a required date column which defaults to a day before current date (do not use hard coded date value in the DDL) d.stock_quantity, a numerical (precision - 3, scale = 0) column which defaults to 1 e, cost_per_plece: a numerical (precision = 5, scale = 2) column f. perishable: a column whose value must be either "Y" or "N" 2. Create another table invoices having the below columns. Deleting a row of the parent table should automatically delete the corresponding child rows in this table. The primary key of this table should be named pk invoices. a. Invoice_number: a primary key column holding string values with length not exceeding 20 b. product_id: a numerical (precision - any length, scale = 0) primary key column which points to the inventory table c. quantity sold: a required numerical (precision = 3, scale = 0) column which defaults to 1 and must always be greater than o d. rate: a required numerical (precision = 5, scale = 2) column e payment type: a string column with length not exceeding 30 3. Create a view vw_inventory_invoices which would fetch the below results only for non-empty cost_per_piece values: a. Involce number b.product_id c.product_name d. last_procured: should be displayed in the sample format like "Saturday, 20 Feb, 2021" e total_cost_price: product of cost_per_plece and quantity sold f. total_selling price: product of rate and quantity sold
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
