Given the following two tables (Students and Marks) in a database, write down the output of the given SQL queries and write down the SQL queries for…
Given the following two tables (Students and Marks) in a database, write down the output of the given SQL queries and write down the SQL queries for the outputs:
Students:
| StudentId | StudentName |
| 1 | Mr. A |
| 2 | Mr. B |
| 3 | Mr. C |
| 4 | Mr. D |
Marks:
| StudentId | Subject | Mark |
| 1 | Math | 70 |
| 2 | Math | 90 |
| 3 | Math | 30 |
| 1 | Bangali | 50 |
| 2 | Bangali | 60 |
| 3 | Bangali | 70 |
| 1 | Physics | 80 |
| 2 | Physics | 70 |
| 3 | Physics | 60 |
(i) SELECT Count (*) FROM Students S LEFT JOIN Marks M;
(ii) SELECT StudentName From Students S JOIN Marks M ON S.StudentId=M.StudentId GROUP BY S.StudentId, S.StudentName HAVING SUM (Mark)>=200;
(iii) List all the students name and number of subjects they have completed.
(iv) List all the students who have not completed any subject.
(v) List all the subject names.
From the BPSC Network/Website Manager (ICT) May 2025 – Written exam, question 5 of 8.
More from this paper
- Previous: a) Suppose you are working with an array of size 10. It contains all the numbers from 1 to 10 exactly once in a random order. But…
- Next: a) Define the term "Data Mining". Explain supervised and unsupervised classification with suitable example. b) How can we validate and…
- All questions in BPSC Network/Website Manager (ICT) May 2025 – Written