Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rezoanulhasan/sql-problem-solving


https://github.com/rezoanulhasan/sql-problem-solving

Last synced: 6 days ago
JSON representation

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.