Consider a database table named Student with the following attributes: student_name – Name of the student gender – Gender ('M' or 'F') class_code…

Consider a database table named Student with the following attributes:

  • student_name – Name of the student
  • gender – Gender ('M' or 'F')
  • class_code – Class identifier
  • test_score – Marks obtained in the test
  1. Retrieve all details of male students who were absent from the test.
  2. Retrieve the names and marks of all students who passed the examination, considering that a student passes if test_score > 40.
  3. Display the minimum, average, and maximum test scores for each class.

From the BPDB Assistant Engineer (CSE) October 2026 – Written (BUET) exam, question 27 of 30.

Answers (1)

1. A student who was absent has no score, i.e. test_score is NULL:

SELECT *
FROM Student
WHERE gender = 'M' AND test_score IS NULL;

2. Names and marks of students who passed:

SELECT student_name, test_score
FROM Student
WHERE test_score > 40;

3. Minimum, average and maximum per class (aggregates skip NULL scores):

SELECT class_code,
       MIN(test_score) AS min_score,
       AVG(test_score) AS avg_score,
       MAX(test_score) AS max_score
FROM Student
GROUP BY class_code;

— rhs

More from this paper