10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

System-defined FunctionsCount Function and NullsThe count function can take as an argument the wildcard character “*”. Thischaracter is used to count the number of rows in a result table, including rowsthat contain nulls. For example, the following statement counts the number ofemployees in department 23:select count(*)from employeewhere dept = 23;You cannot qualify the asterisk (*) argument with all or distinct.Because count(*) counts rows rather than columns, count(*) does not ignorenulls. Consider the following table:NameExemptionsAllen 0Curtiz 2Fleming 4WellmanHitchcocknullnullThe statement:count(exemptions)returns the value “3”, whereas the statementcount(*)returns “5”.With the exception of count, if the argument to an aggregate functionevaluates to an empty set, then the function returns a null. The count functionreturns a zero.How You Can Use the Group By Clause with Aggregate FunctionsThe group by clause allows aggregate functions to be performed on subsets ofthe rows in the table. The subsets are defined by the group by clause.62 <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!