S p o r t s D a t a B a s e . c o m
a sports data query language (SDQL ©) consultancy

Permission is given to quote trends found on SportsDataBase.com provided that a reference and a link to SportsDataBase.com is provided. E.g.: Trend found on SportsDataBase.com


Information you need to win
TOC  |  Introduction  |  Basics  |  Prefixes  |  Parameters  |  Group-By  |  Summative  |  Links  |  e-mail

The Group-By Feature

One of the most powerful and time saving features of the SDQL is the group-by feature. This allows you to compare results for several related situations with a single query. There are two ways in which to instantiate a group-by: implicitly by using a parameter without a condition and explicitly by using a comma delimited set of conditions.

To see the average number of three pointers made for each NBA team in the 2007 season use the SDQL:
Average(three pointers made)@team and season=2007
Note that since the team parameter is not set to any value, each value occuring in the database is returned.

An explicit group-by is performed by using a comma delimited set of values. To see how NFL teams do after scoring fewer than 3, 7, 10, and 14 points use the SDQL:
p:points < 3, 7, 10, 14

SDQL also allows ranges of values to be groups as per:
0, 10, 14 <= p:points < 10, 14, 21

The implicit and explicit group-by methods can be combined. To add the League results to the above query for average number of three pointers made use the SDQL:
Average(three pointers made)@team,1 and season=2007


TOC  |  Introduction  |  Basics  |  Prefixes  |  Parameters  |  Group-By  |  Summative  |  Links  |  e-mail
e-mail links:   Content@SportsDataBase.com    Support@SportsDataBase.com   
Content for this is generated using the Sports Data Query Language (SDQL).
Google Groups
Subscribe to SportsDataBase
Email:
Visit this group