• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Week | 3 Complete Data Analytics | Question 7

Consider the following SQL query:

SELECT customers.customer_id, customers.customer_name, COUNT(orders.order_id) AS order_count
FROM customers
LEFT JOIN orders ON customers.customer_id = orders.customer_id
GROUP BY customers.customer_id, customers.customer_name
HAVING COUNT(orders.order_id) > 5;

What does this query do?

(A)

Retrieves customers with more than 5 orders.

(B)

Retrieves customers and the count of their orders, including those with no orders.

(C)

Retrieves customers with exactly 5 orders.

(D)

Retrieves customers and the count of their orders, excluding those with no orders.

Answer

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments