Completed
Incomplete
Not Attended
Completed
Incomplete
Not Attended
GadgetGrove, a popular electronics and sports equipment store, has hired you to help manage their inventory and sales database. As their SQL expert, you're tasked with writing queries to help the store manager make informed decisions about inventory management and sales strategies. The database contains two tables: 'products' for inventory information and 'sales' for transaction records. Your job is to provide insights and help optimize the store's operations.
The store manager wants to know which products are running low on stock. Can you provide a list of products with less than 100 items in stock, showing the product name, current stock quantity, and category?
The marketing team wants to run a promotion on the least sold product. Can you find the product with the lowest total quantity sold, and display its name, category, and total quantity sold?
The store recently received a new shipment of Laptops. Update the stock quantity of Laptops by adding 25 to the current stock. Then, display the updated product information for Laptops.
The finance department needs a report on the total revenue generated by each product category. Can you calculate the total revenue (price * quantity sold) for each category and display the category and total revenue?
The store manager wants to identify the best-selling product in terms of quantity sold. Find the product with the highest total quantity sold, and display its name, total quantity sold, and the date of its last sale.
id | name | category | price | stock_quantity |
1 | Laptop | Electronics | 999.99 | 50 |
2 | Smartphone | Electronics | 599.99 | 100 |
3 | Headphones | Electronics | 149.99 | 200 |
4 | Running Shoes | Sports | 79.99 | 150 |
5 | Yoga Mat | Sports | 29.99 | 100 |
id | product_id | sale_date | quantity |
1 | 1 | 2023-01-15 | 5 |
2 | 2 | 2023-01-16 | 10 |
3 | 3 | 2023-01-17 | 15 |
4 | 4 | 2023-01-18 | 8 |
5 | 5 | 2023-01-19 | 12 |
6 | 1 | 2023-01-20 | 3 |
7 | 2 | 2023-01-21 | 7 |
>>> Submit Your Query to validate