• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Sql group functions

on

  • 558 views

& concept explained easily

& concept explained easily

Statistics

Views

Total Views
558
Views on SlideShare
558
Embed Views
0

Actions

Likes
0
Downloads
5
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Sql group functions Sql group functions Presentation Transcript

    • SQL Group Functions
    • Chapter Objectives
      • Differentiate between single-row and multiple-row functions
      • Use the SUM and AVG functions for numeric calculations
      • Use the COUNT function to return the number of records containing non-NULL values
      • Use COUNT(*) to include records containing NULL values
    • Chapter Objectives
      • Use the MIN and MAX functions with non-numeric fields
      • Determine when to use the GROUP BY clause to group data
      • Identify when the HAVING clause should be used
      • List the order of precedence for evaluating WHERE, GROUP BY, and HAVING clauses
    • Chapter Objectives
      • State the maximum depth for nesting group functions
      • Nest a group function inside a single-row function
      • Calculate the standard deviation and variance of a set of data, using the STDDEV and VARIANCE functions
    • Group Functions
      • Return one result per group of rows processed
      • Also called multiple-row and aggregate functions
      • All group functions ignore NULL values except COUNT(*)
      • Use DISTINCT to suppress duplicate values
    • SUM Function
      • Calculates total amount stored in a numeric column for a group of rows
    • AVG Function
      • Calculates average of numeric values in a specified column
    • COUNT Function
      • Two purposes:
        • Count non-NULL values
        • Count total records, including those with NULL values
    • COUNT Function – Non-NULL Values
      • Include column name in argument to count number of occurrences
    • COUNT Function – NULL Values
      • Include asterisk in argument to count number of rows
    • MAX Function
      • Returns largest value
    • MIN Function
      • Returns smallest value
    • GROUP BY Clause
      • Used to group data
      • Must be used for individual column in the SELECT clause with a group function
      • Cannot reference column alias
    • GROUP BY Example
    • HAVING Clause//
      • Serves as the WHERE clause for grouped data
    • Order of Clause Evaluation
      • When included in the same SELECT statement, evaluated in order of:
        • WHERE
        • GROUP BY
        • HAVING
    • Nesting Functions
      • Inner function resolved first
      • Maximum nesting depth: 2
    • Statistical Group Functions
      • Based on normal distribution
      • Includes:
        • STDDEV
        • VARIANCE
    • STDDEV Function
      • Calculates standard deviation for grouped data
    • VARIANCE Function
      • Determines data dispersion within a group