A database table is defined as books(book_id, title, category), where many books can share one category. Which of the following SQL queries correctly lists each category that contains MORE THAN 4 books, together with the number of books in that category?
SELECT category, COUNT(*) FROM books GROUP BY category HAVING COUNT(*) > 4;
SELECT category, COUNT(*) FROM books WHERE COUNT(*) > 4 GROUP BY category;
SELECT category, COUNT(*) FROM books GROUP BY category WHERE COUNT(*) > 4;
SELECT category, COUNT(*) FROM books HAVING COUNT(*) > 4;
The verified answer and full solution are one login away
Every answer here is machine verified, with a step-by-step solution that teaches the method. Your login also unlocks a 7-question mock preview in the real exam interface.
Log in to see the answerMore sql questions