Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

UGC-NET | UGC NET CS 2016 Aug – II | Question 20

  • Last Updated : 11 Apr, 2018

Consider a database table R with attributes A and B. Which of the following SQL queries is illegal ?
(A) SELECT A FROM R;
(B) SELECT A, COUNT(*) FROM R;
(C) SELECT A, COUNT(*) FROM R GROUP BY A;
(D) SELECT A, B, COUNT(*) FROM R GROUP BY A, B;


Answer: (B)

Explanation: SELECT A FROM R; legal query
SELECT A, COUNT(*) FROM R; Illegal query because we can’t SELECT A, COUNT(*) unless it is grouped by A.
SELECT A, COUNT(*) FROM R GROUP BY A; legal query
SELECT A, B, COUNT(*) FROM R GROUP BY A, B; legal query
So, option (B) is correct.


Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!