Final Evaluation – SQL Course
SQL Database Examination
Total Marks: 100
Duration: 90–120 minutes
Format: Mixed (MCQs, Short Answer, Practical Queries)
Section A: Multiple Choice Questions (20 Marks)
Each question is 1 mark.
1. What SQL clause is used to sort results?
Answer: C
2. Which SQL function returns the total number of rows?
Answer: A
3. A foreign key in SQL:
Answer: B
4. Which keyword is used to remove a table from the database?
Answer: C
(Add more as needed.)
Section B: Short Answer (20 Marks)
Each question carries 5 marks. Write 3–4 lines.
1. Explain the difference between INNER JOIN and LEFT JOIN.
2. What is normalization and why is it important?
3. Define a view and give a use-case.
4. Explain the difference between WHERE and HAVING.
Section C: Practical SQL Queries (40 Marks)
Use the schema provided and write SQL queries for the following:
Schema:
students(id, name, department, age)
courses(id, title, credits)
enrollments(student_id, course_id, grade)
Tasks (8 marks each):
- List all students along with the names of courses they are enrolled in.
- Find students with no enrollments.
- Retrieve departments with more than 3 students.
- Display average grades per course.
- Write a query to find students who are enrolled in all courses offered.
Section D: Case Study & Analysis (20 Marks)
Case Study: Blogging Platform
Tables:
users(id, username)
posts(id, user_id, title)
likes(user_id, post_id)
Tasks:
- Write a query to find users with the most posts. (5 marks)
- Write a query to find the top 3 most liked posts. (5 marks)
- Identify users who liked their own posts. (5 marks)
- Suggest an index to optimize likes count per post and explain. (5 marks)