SQL Assignment Questions
1. Write SQL to create a database named shop.
2. Create a table products with columns: id INT PRIMARY KEY AUTO_INCREMENT, name
VARCHAR(100), price DECIMAL(8,2).
3. Insert 5 sample records into products.
4. Write SQL to update the price of product with id = 2 to 450.75.
5. Delete the product with id = 3.
6. Select all products where price is greater than 200.
7. Create a table customers with fields cust_id INT AUTO_INCREMENT PRIMARY KEY,
cust_name VARCHAR(50), city VARCHAR(50).
8. Insert 3 sample customers into customers.
9. Write SQL to display only distinct city names from customers.
10. Write SQL to count total number of products in the products table.
11. Write SQL to find all books whose author name ends with 'n'.
12. Select books ordered by price in ascending order.
13. Select the top 3 most expensive books.
14. Count how many members are in the members table.
15. Write SQL to display only unique author names from books.
16. Write SQL to find the maximum price of a book.
17. Write SQL to find the minimum price of a book.
18. Write SQL to calculate the average price of books.
19. Add a new column email VARCHAR(100) to the members table.
20. Update the email of the member with member_id = 1 to ram@[Link].