FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Understanding `GROUP BY` in SQL
NewsMachine Learning

Understanding `GROUP BY` in SQL

via Dev.toandrewlegacci1d ago

GROUP BY is one of those SQL clauses that starts out feeling simple and then becomes confusing as soon as real queries get involved. The short version is that it lets you take many rows and treat some of them as belonging to the same group, usually so you can calculate something for each group. That idea matters more than the syntax. GROUP BY is not mainly about sorting, filtering, or removing duplicates. It is about collapsing rows into groups based on shared values, then producing one result row per group. What GROUP BY does Imagine a table called orders : order_id | user_id | status | amount ---------|---------|---------|------- 1 | 10 | paid | 50 2 | 10 | paid | 20 3 | 11 | pending | 15 4 | 12 | paid | 40 5 | 11 | paid | 30 If you run this: SELECT status FROM orders ; you get one row per order. If instead you run this: SELECT status FROM orders GROUP BY status ; you get one row per distinct status value: paid pending At first glance, that can look similar to DISTINCT , and in this

Continue reading on Dev.to

Opens in a new tab

Read Full Article
3 views

Related Articles

Nova Scotia just changed the rules — is your PR plan still on track?
News

Nova Scotia just changed the rules — is your PR plan still on track?

Medium Programming • 1d ago

I’d Give Up My Mac Before I Gave Up These Apps
News

I’d Give Up My Mac Before I Gave Up These Apps

Medium Programming • 1d ago

If It Quacks Like a Package Manager
News

If It Quacks Like a Package Manager

Lobsters • 1d ago

Your App Just Went Down. Here’s Exactly What to Do in the Next 60 Minutes.
News

Your App Just Went Down. Here’s Exactly What to Do in the Next 60 Minutes.

Medium Programming • 1d ago

Put the ZIP code first
News

Put the ZIP code first

Lobsters • 1d ago

Discover More Articles