tarmogoyf

SQL

Oct 31st, 2023
1,237
0
Never
5
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.07 KB | Software | 0 0
  1. Task Description:
  2.  
  3. You have been given a DATABASE containing information about a company's sales. The database has two tables: sales and products.
  4.  
  5. Table sales
  6.  
  7. sale_id (integer): A unique identifier for each sale.
  8. product_id (integer): The ID of the product sold.
  9. quantity (integer): The quantity of the product sold in that particular sale.
  10. sale_date (date): The date of the sale.
  11. Table products
  12.  
  13. product_id (integer): A unique identifier for each product.
  14. product_name (text): The name of the product.
  15. unit_price (decimal): The price of one unit of the product.
  16. Task Requirements:
  17.  
  18. Write a SQL query to find the total revenue generated by each product in the year 2023. Sort the results in descending order by revenue. Your query should return the following columns:
  19.  
  20. product_name (name of the product)
  21. total_revenue (the total revenue generated by the product in 2023)
  22. Additional Notes:
  23.  
  24. You should only consider sales that occurred in the year 2023.
  25. The total revenue for each product can be calculated by multiplying the quantity by the unit_price for each sale.
Tags: sql
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment