SQL Assignment: WHERE, Aggregates,
LIKE and Logic Operators
Prof. Arjun Vankani
September 2025
Database 1: Myntra E-Commerce System
Tables Overview
• Product(product id, name, brand, category, price, stock)
• Customer(customer id, name, city, gender)
• Orders(order id, customer id, order date, total amount)
• OrderDetails(detail id, order id, product id, quantity)
Tasks
1. Display all products where the price is greater than 1000.
2. Show all customers who live in cities starting with ’M’.
3. Find products whose brand contains the word ’Roadster’.
4. List all female customers from ’Mumbai’ or ’Delhi’.
5. Display the total number of products in stock (use SUM).
6. Find the average order amount from the Orders table.
7. Show the product with the minimum price.
8. Find customers who are not from ’Bangalore’.
9. Display total orders placed by each customer (use COUNT with GROUP BY).
10. List customers whose name starts with ’A’ and ends with ’a’.
11. Find products where the category contains exactly 5 letters.
12. Show the total quantity sold for each product ID.
13. Display products where price > 1000 AND < 3000.
14. Show customers who are either from ’Surat’ or ’Ahmedabad’ but not male.
15. Display product name and price including 18% GST (price * 1.18).
1
Database 2: LinkedIn-Like Professional Network
Tables Overview
• User(user id, name, email, city, profession)
• Connection(conn id, user id1, user id2)
• Post(post id, user id, content, post date, likes)
• Skill(skill id, user id, skill name)
Tasks
1. Display all users from ’Pune’ or ’Hyderabad’.
2. Find all posts with more than 100 likes.
3. Count how many users are in ’Developer’ profession.
4. Show posts where the content includes the word ’career’.
5. Display users whose name ends with ’n’.
6. List users who do not have ’Python’ in their skills.
7. Count the total number of connections in the system.
8. Show the maximum number of likes received on a post.
9. Find average likes per user (use AVG + GROUP BY).
10. List users who have more than 3 skills.
11. Display users whose city name contains exactly 6 letters.
12. Show user names and double the likes they received (likes * 2).
13. List all users who are either ’Analyst’ or ’Consultant’ but not from ’Delhi’.
14. Find all skills starting with ’Data’.
15. List all users who have posted on or after ’2024-01-01’.