Question: need query.sql. these are the fields: trans_id : a SERIAL (this is the order id mentioned below) cust_id : a string that uniquely identifies the

need query.sql.

these are the fields:

trans_id : a SERIAL (this is the "order id" mentioned below)

cust_id : a string that uniquely identifies the customer

employee: a string for the name of the employee who is managing this transaction (sorry I managed to miss this field in the initial writeup)

prod_id : a string that uniquely identifies the product sold to the customer

supplier_id : a string that identifies where we get the product from

quantity : an integer for how much of the product was sold

unit_price :the price for one unit of the product

trans_date: date on which the transaction was completed

need query.sql. these are the fields: trans_id : a SERIAL (this is

3. Create a script "query.sql" that includes semicolon-separated queries to do the following (terminate each query with a semicolon so the grader can run the whole script at once) : 1. List distinct suppliers used by company 1. Make sure there is more than one record for at least one supplier 2. List order ID, customers helped by Tom and the dates on which the orders he helped with were completed. 1. There should be at least two orders for Tom to help with 3. List suppliers, product ID, quantity, price, transaction date, with a generated total cost column, ordered most recent to oldest 1. Orders should take place on more than one date 2. The cost is just the product of quantity and price 3. Give this column an alias (nickname) and use the alias in the ORDER BY clause 4. The "ORDER" keyword is why we cannot just call the table Order 4. List order id, customer, employee, supplier, trans_date that completed in December 2022 1. Here, the EXTRACT function described in PostgreSQL: Documentation: 15: 9.9. Date/Time Functions and Operators answer 2. Try EXTRACT in the SELECT clause first to see how it behaves

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!