SQL COUNT function
SQL COUNT function Description The SQL COUNT function is used to count the number of rows returned in a SELECT statement. Syntax The syntax for the SQL COUNT function is: SELECT COUNT( expression ) FROM tables WHERE conditions; Parameters or Arguments expression can be a numeric field or formula. Only includes NOT NULL Values Not everyone realizes this, but the SQL COUNT function will only include the records in the count where the value of expression in COUNT( expression ) is NOT NULL. When expression contains a NULL value, it is not included in the COUNT calculations. Lets look at a SQL COUNT function example that demonstrates how NULL values are evaluated by the COUNT function. For example, if you have the following table called suppliers : supplier_id supplier_name state 1 IBM CA 2 Microsoft 3 NVIDIA And if you ran the following SQL SELECT statement that uses the SQL COUNT function: SELECT COUNT(supplier_id) FROM suppliers; This SQL COUNT ex...