SQL Worksheet Practice Questions 02.05.2025
SQL Worksheet Practice Questions 02.05.2025
2025
Table 1: Books
| BCode | Title | Price | Author | Category |
|-------|--------------------|-------|----------------|-------------|
| 101 | Learn SQL | 450 | John Walker | Database |
| 102 | Web Designing | 550 | Anita Sharma | Web |
| 103 | Python Programming | 600 | M. Reddy | Programming |
| 104 | Java Basics | 500 | Raj Kapoor | Programming |
| 105 | HTML Essentials | 400 | Anita Sharma | Web |
Table 2: Students
| Student ID | Name | Major | Age |
|-----------|----------|--------------|-----|
|1 | Alice | Physics | 21 |
|2 | Bob | Computer Sci | 22 |
|3 | Charlie | Physics | 20 |
|4 | Diana | Mathematics | 23 |
|5 | Eric | Computer Sci | 21 |
Table 3: Grades
| StudentID | Course | Score |
|-----------|------------|-------|
|1 | SQL | 78 |
|2 | SQL | 88 |
|2 | Algorithms | 90 |
|3 | Networks | 82 |
|3 | SQL | 84 |
|4 | Algorithms | 85 |
|5 | Networks | 91 |
SQL Questions
1. Display the strings 'HELLO WORLD' and 'GOOD MORNING' in lower case.
2. Extract the date from the string '2023-11-10 14:45:22' using string functions
only.
3. Remove trailing spaces from the string ' CodeWithSQL '.
4. Find the result of 127 % 9.
5. Update the price of 'Web Designing' to 575.
6. Find the average price of all books.
7. Display each book's title with a 10% increased price.
8. Delete all books written by 'Anita Sharma'.
9. Display all books with BCode greater than 102.
10. Display the book title and category where category is not 'Web'.
11. Display all distinct authors from the table.
12. Display the title and price of books where the title starts with 'P'.
13. List the titles and price of books in ascending order of price.
14. Count the number of books in the 'Programming' category.
15. Display student names along with courses and scores (use JOIN).
16. List names of students who have taken the SQL course.
17. Find students who scored above 85 in any course.
18. Show the average score of each student.
19. List the students who have not taken any course.
20. Display students who have taken more than one course.
21. For each course, show the highest scoring student.
22. List students who have scored above the average score of their course.
23. Show each student's name and the number of courses they have taken.
SUBHO’S
COMPUTER INSTITUTE FOR SCHOOL, BARRAKPORE, KOLKATA-700120
Ph NO:- 9831934306/9051334306, ICSE/ISC-V TO XII , CBSE-XI&XII