Welcome to PC Teach Me...

Free Computer Training Videos.

Although you do not need to register to access this site. Registering has its benefits. Such as:

  • Access to training material associated with the video you are watching [if applicable]
  • Automatic email updates when new training videos are available.
  • Ask for a training video.
  • Exclusive access to pose questions to me [limited availability as I am doing this for free :-)].
  • Free contribution of your own training topics, this includes referencing your videos outside of PC Teach Me.
  • Its Free!

Member Login

Lost your password?

Not a member yet? Sign Up!

By registering with this blog you are also agreeing to receive email notifications for new posts but you can unsubscribe at anytime.

24778 Registered Users
71 Number Of Articles
Free Video Tutorials (Email) Free Video Tutorials (RSS) Free Video Tutorials (Twitter) Free Video Tutorials (Flickr)

SQL: Group By Clause

Part of Microsoft SQL Basics

sql SQL: Group By Clause SQL: Aggregating your data

The more data you start interrogating the more records you will return. Its always the same, you start off with basic criteria and before you know it you are referencing several tables to obtain the information your after.

The questions being asked are no longer “what was the price of that product?” the questions are more generic, like “How many orders did we do this month?”. The more tables you add to a query the more likley you are going to ask summary style questions of the data as you are no longer interested in specific records your more interested in trends.

This opens up a whole new avenue of reporting:

  1. Transactional SQL
    Transactional style report are generally to the lowest level of granularity.  I.e. row by row
  2. Analytical SQL
    Sumurising your data into logical groupings such as regional or product type reporting.  This syle will…dare I say MUST have some form of aggregation.  I.e. Count of orders, total value of orders etc…

SQL Grouping of data

To get the ball rolling on this aspect of SQL you need to start using the group by clause. This clause allows the user to summarise information in the form of aggregated values which you assign to specific fields (i.e. group to them).

This video will cover the basics of how you start grouping your data into summary information. The video will start by explaining on the small scale but then show you on multiple tables how it is achieved. This is not the end of the story with group by but this should give you the knowledge to plow into some rather meaty queries.

Other SQL Videos

This video is one of many SQL tutorials on this site click here for more

Related Posts

171 Comments

  1. lceus says
    31 Mar 15 at 7:31pm

    First time I see a good explanation of group by.

  2. SmithsRichard says
    09 Mar 14 at 3:58am

    I never understood group by properly but this video helped me a lot. thanks
    brother.

  3. Atanatir Osgiliat says
    22 Sep 13 at 1:33am

    Very clear, thank you.

  4. 3628800258 says
    30 Aug 12 at 4:11am

    Great video, helped me a lot

  5. PCTeachME says
    11 Jul 11 at 2:05pm

    Great Stuff! Make sure you check out the website as there are numerous videos on here that may have example files which you can download to follow along to. Have a look at the ssis vids some discuss denormalise vs. normailised data. If you have an idea for a topic send me an email. Thanks for your feedback!

  6. PCTeachME says
    11 Jul 11 at 2:05pm

    [..YouTube..] Great Stuff! Make sure you check out the website as there are numerous videos on here that may have example files which you can download to follow along to. Have a look at the ssis vids some discuss denormalise vs. normailised data. If you have an idea for a topic send me an email. Thanks for your feedback!

  7. PCTeachME says
    11 Jul 11 at 2:05pm

    [..YouTube..] @theprankie Great Stuff! Make sure you check out the website as there are numerous videos on here that may have example files which you can download to follow along to. Have a look at the ssis vids some discuss denormalise vs. normailised data. If you have an idea for a topic send me an email. Thanks for your feedback!

  8. PCTeachME says
    11 Jul 11 at 2:05pm

    @theprankie Great Stuff! Make sure you check out the website as there are numerous videos on here that may have example files which you can download to follow along to. Have a look at the ssis vids some discuss denormalise vs. normailised data. If you have an idea for a topic send me an email. Thanks for your feedback!

  9. PCTeachME says
    11 Jul 11 at 2:05pm

    @theprankie Great Stuff! Make sure you check out the website as there are numerous videos on here that may have example files which you can download to follow along to. Have a look at the ssis vids some discuss denormalise vs. normailised data. If you have an idea for a topic send me an email. Thanks for your feedback!

  10. PCTeachME says
    11 Jul 11 at 2:05pm

    @theprankie Great Stuff! Make sure you check out the website as there are numerous videos on here that may have example files which you can download to follow along to. Have a look at the ssis vids some discuss denormalise vs. normailised data. If you have an idea for a topic send me an email. Thanks for your feedback!

  11. PCTeachME says
    11 Jul 11 at 2:05pm

    @theprankie Great Stuff! Make sure you check out the website as there are numerous videos on here that may have example files which you can download to follow along to. Have a look at the ssis vids some discuss denormalise vs. normailised data. If you have an idea for a topic send me an email. Thanks for your feedback!

Leave a Comment

You must be logged in to post a comment.

Valid XHTML 1.0 Transitional website security