Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rezoanulhasan/sql-problem-solving
https://github.com/rezoanulhasan/sql-problem-solving
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rezoanulhasan/sql-problem-solving
- Owner: RezoanulHasan
- Created: 2023-11-02T15:41:21.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-02T21:20:00.000Z (about 1 year ago)
- Last Synced: 2023-11-03T17:01:03.648Z (about 1 year ago)
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sql-problem-solving
### Database Information:
The database contains the following tables:- Customers: Contains information about the customers, such as customer ID, name, email, and location.
- Orders: Contains information about the orders placed by customers, such as order ID, customer ID, order date, and total amount.
- Products: Contains information about the products available for purchase, such as product ID, name, description, and price.
- Categories: Contains information about the different categories of products, such as category ID and name.
- Order_Items: Contains information about the individual items included in each order, such as order item ID, order ID, product ID, quantity, and unit price.### Tasks:
- Write a SQL query to retrieve all the customer information along with the total number of orders placed by each customer. Display the result in descending order of the number of orders.- Write a SQL query to retrieve the product name, quantity, and total amount for each order item. Display the result in ascending order of the order ID.
- Write a SQL query to retrieve the total revenue generated by each product category. Display the category name along with the total revenue in descending order of the revenue.
- Write a SQL query to retrieve the top 5 customers who have made the highest total purchase amount. Display the customer name along with the total purchase amount in descending order of the purchase amount.