Q1. Show all columns and rows from the products table.
A1. SELECT * FROM products;
Q2. Find the names of all employees whose department is ’Sales’.
A2. SELECT firstname FROM employees WHERE department = ’Sales’;
Q3. List all customers with a non-null score.
A3. SELECT * FROM customers WHERE score IS NOT NULL;
Q4. Show all orders shipped in February 2025.
A4. SELECT * FROM orders WHERE MONTH(shipdate) = 2 AND YEAR(shipdate) = 2025;
Q5. What is the total sales amount in the orders table?
A5. SELECT SUM(sales) FROM orders;
Q6. List customers and their order counts from the orders table (include customers with zero orders).
A6. SELECT [Link], COUNT([Link]) AS orders_count FROM customers c LEFT JOIN orders o
ON [Link] = [Link] GROUP BY [Link];
Q7. Display product name and price for products priced above 15.
A7. SELECT product, price FROM products WHERE price > 15;
Q8. Find the average salary for each department in employees table.
A8. SELECT department, AVG(salary) AS avg_salary FROM employees GROUP BY department;
Q9. List the number of orders made by each customer in 2025.
A9. SELECT customerid, COUNT(orderid) AS num_orders FROM orders WHERE YEAR(orderdate) =
2025 GROUP BY customerid;
Q10. Show all employee names with their manager names (self join).
A10. SELECT [Link] AS Employee, [Link] AS Manager FROM employees e LEFT JOIN
employees m ON [Link] = [Link];
Q11. Create a view that shows for each customer, the sum of their order sales.
A11. CREATE VIEW customer_order_sales AS SELECT customerid, SUM(sales) AS total_sales FROM
orders GROUP BY customerid;
Q12. Show orders and their products using an INNER JOIN.
A12. SELECT [Link], [Link] FROM orders o INNER JOIN products p ON [Link] = [Link];
Q13. Find customers who never placed an order (LEFT JOIN).
A13. SELECT [Link] FROM customers c LEFT JOIN orders o ON [Link] = [Link]
WHERE [Link] IS NULL;
Q14. For each order, display the order date plus 5 days (date function).
A14. SELECT orderid, DATE_ADD(orderdate, INTERVAL 5 DAY) AS new_date FROM orders;
Q15. Find the highest sale in every order status (window/aggregation).
A15. SELECT orderstatus, MAX(sales) AS max_sale FROM orders GROUP BY orderstatus;