count returns the number of rows in the query. You can use it as an aggregate or analytic function. If you specify expr, then count returns the number of rows where expr is not null. You can count either all rows, or only distinct values of expr. If you specify the asterisk (*), then this function returns all rows, including duplicates and nulls. count never returns null.