STUDENT Observe the table STUDENT: STUDENT StudentID SSN Name Class D111 111-11-
ID: 3661438 • Letter: S
Question
STUDENT
Observe the table STUDENT:
STUDENT
StudentID SSN Name Class
D111 111-11-1111 Connor Freshman
D222 222-22-2222 Trevor Freshman
D333 333-33-3333 Connor Sophomore
D444 444-44-4444 Parker Sophomore
D555 555-55-5555 Connor Sophomore
This table will be used for the following question citing table STUDENT.
What will be the result of the following query on table STUDENT? SELECT COUNT( *) FROM student GROUP BY class;
Number 5
Number 2
Numbers 2 and 3
Numbers 1 and 1
Number 5
Number 2
Numbers 2 and 3
Numbers 1 and 1
Explanation / Answer
The correct option is "Numbers 2 and 3".
This is the third option in multiple choice.
-------------------------------------------------------------------------------------------
Explanation:
Given Student table
StudentID
SSN
Name
Class
D111
111-11-1111
Connor
Freshman
D222
222-22-2222
Trevor
Freshman
D333
333-33-3333
Connor
Sophomore
D444
444-44-4444
Parker
Sophomore
D555
555-55-5555
Connor
Sophomore
In the above table, the Class attribute has two groups of classes
namely called "Freshman" and "Sophomore".
The GROUP BY clause that retrieves the rows of the given attribute
to GROUP BY clause.
The sql statement
SELECT COUNT( *) FROM student GROUP BY class
first group by the class then count the number of Class attribute
and then print the count of the each groups as result of the sql statement.
COUNT(*)
2
3
StudentID
SSN
Name
Class
D111
111-11-1111
Connor
Freshman
D222
222-22-2222
Trevor
Freshman
D333
333-33-3333
Connor
Sophomore
D444
444-44-4444
Parker
Sophomore
D555
555-55-5555
Connor
Sophomore
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.