Exercise 6.4 - Summary:
In pg-admin, create a SQL script that does the following:
Tables:
Sales_Header. Alias asshSales_Detail. Alias assd
Attributes:
- Distinct Count of 
sale_id. Alias astotal_transactions - Sum of total 
items_sold. Alias astotal_products_sold - Average 
feedback_scorerounded to 1 decimal place. Alias asavg_feedback - Sum of total 
revenue_net. Alias asrevenue - Sum of total 
cost_of_sales. Alias ascost_of_sales - Sum of total 
revenue_netminus sum of totalcost_of_sales. Alias asgross_profit 
- 
Test this script in PostgreSQL
- The names and data should match the screenshot
 
 - 
Convert this SQL script into a
VIEWcalledv_Summary - 
Append SQL to
SELECT * FROMthisVIEWinto the space provided in line 13 of backend/routes/summary.js - 
Save and close backend/routes/summary.js
 
You may need to close and re-run your Docker session for this to take effect
- In a new browser tab, preview the transactions route (http://localhost:5001/summary)
- This should be populated with an array of a single object containing the 6 attributes
 
 
- This is the data that our front-end will use to populate the Summary cards on the web page
 
- In the main Sequel-Mark website (http://localhost:5001), check the Summary cards have been populated