Write an OQL query that, for each major, computes the number of students who have that major. Use the Student class de?ned in (14.14)
What will be an ideal response?
SELECT Major: M, count: count(S2.Id)
FROM StudentExt S, StudentExt S2, S.Major M
WHERE M IN S2.Major
GROUP BY M
We could also write this query using nested queries as follows:
SELECT DISTINCT Major: M,
count: count(SELECT S2.Id
FROM StudentExt S2
WHERE M IN S2.Major)
FROM StudentExt S, S.Major M
Computer Science & Information Technology
You might also like to view...
What are rules?
A) Regulations that govern a society B) Expectations of the people for a decent society C) Regulations that govern the conduct of the people D) Regulations that govern legal conduct
Computer Science & Information Technology
Which of the following is not a syntax error?
a. std::cout <<39Hello world! 39;;
b. std::cout <
Computer Science & Information Technology