Question:

What’s wrong in the following query?

SELECT subject_code, count(name)  
FROM students;

Answer:

It doesn’t have a GROUP BY clause. The subject_code should be in the GROUP BY clause.

   SELECT subject_code, count(name)
   FROM students
   GROUP BY subject_code;

Keywords:

© 2017 QuizBucket.org