SQL Set Functions

Part of the SQL All-in-One For Dummies Cheat Sheet

Sometimes, the information that you want to extract from an SQL table doesn't relate to individual rows but rather to sets of rows. SQL provides five set (or aggregate) functions to deal with such situations — COUNT, MAX, MIN, SUM, and AVG. Each function performs an action that draws data from a set of rows rather than from a single row:

COUNT Returns the number of rows in the specified table
MAX Returns the maximum value that occurs in the specified table
MIN Returns the minimum value that occurs in the specified table
SUM Adds up the values in a specified column
AVG Returns the average of all the values in the specified column
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus

SERIES
SQL All-in-One For Dummies Cheat Sheet

Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.