HomeInterview QuestionsOn which column would you use GROUP BY?

On which column would you use GROUP BY?

🟢 Easy Conceptual Fresher level
1Times asked
Jul 2026Last seen
Jul 2026First seen

💡 Model Answer

You would use GROUP BY on the columns that define the logical grouping of your data. These are typically the key attributes that identify the categories you want to aggregate over. For example, if you want to find the total sales per customer, you would GROUP BY customer_id. If you want to count orders per day, you would GROUP BY order_date. The columns you choose should be those that you want to preserve as distinct values in the result set, while the other columns are aggregated using functions such as SUM, AVG, COUNT, MAX, or MIN.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.

Get Assisting AI — Starts at ₹500