Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 767449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:01:43+00:00 2026-05-14T18:01:43+00:00

This has always bothered me – why does the GROUP BY clause in a

  • 0

This has always bothered me – why does the GROUP BY clause in a SQL statement require that I include all non-aggregate columns? These columns should be included by default – a kind of “GROUP BY *” – since I can’t even run the query unless they’re all included. Every column has to either be an aggregate or be specified in the “GROUP BY”, but it seems like anything not aggregated should be automatically grouped.

Maybe it’s part of the ANSI-SQL standard, but even so, I don’t understand why. Can somebody help me understand the need for this convention?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T18:01:43+00:00Added an answer on May 14, 2026 at 6:01 pm

    It’s hard to know exactly what the designers of the SQL language were thinking when they wrote the standard, but here’s my opinion.

    SQL, as a general rule, requires you to explicitly state your expectations and your intent. The language does not try to “guess what you meant”, and automatically fill in the blanks. This is a good thing.

    When you write a query the most important consideration is that it yields correct results. If you made a mistake, it’s probably better that the SQL parser informs you, rather than making a guess about your intent and returning results that may not be correct. The declarative nature of SQL (where you state what you want to retrieve rather than the steps how to retrieve it) already makes it easy to inadvertently make mistakes. Introducing fuzziniess into the language syntax would not make this better.

    In fact, every case I can think of where the language allows for shortcuts has caused problems. Take, for instance, natural joins – where you can omit the names of the columns you want to join on and allow the database to infer them based on column names. Once the column names change (as they naturally do over time) – the semantics of existing queries changes with them. This is bad … very bad – you really don’t want this kind of magic happening behind the scenes in your database code.

    One consequence of this design choice, however, is that SQL is a verbose language in which you must explicitly express your intent. This can result in having to write more code than you may like, and gripe about why certain constructs are so verbose … but at the end of the day – it is what it is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

One of the things that has always bothered me about <jsp:include..> is that it's
This question has always bothered me. And the NetBeans wiki does not say anything
This is something that has always bothered me about PHP and I have never
This one of the things that has always bothered me about Matlab. I understand
Something that has always puzzled me, and still does to this day, is why
This is something that has always bothered me. Wouldnt it make more sense to
This has always bothered me. Why is it people say to unit test in
This has always bothered me, and I've never really come up with my own
This has always bothered me... Let's say I have an interface IFiddle and another
It has always bothered me that the only way to copy a file in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.