SQL is a language family for defining and querying relational databases and modifying their contents. A query such as SELECT customer, COUNT(*) FROM orders GROUP BY customer groups rows by customer and counts each group. A WHERE condition filters rows before grouping; HAVING filters groups afterward. Implementations usually use bag semantics, retaining duplicates unless removed explicitly. Null values also introduce three-valued condition evaluation, so ordinary two-valued logical rewrites need care. Standard features and vendor extensions must be distinguished when portability matters.[ref]
SQL NULL marks a missing or unknown value. Ordinary comparisons involving SQL NULL, including NULL = NULL, produce the truth value unknown. To test a scalar value for absence, use IS NULL; to compare while treating two missing values alike, use IS NOT DISTINCT FROM.[ref]
This three-valued logic changes query reasoning. 5 NOT IN (2, NULL) is unknown: five differs from two, but the missing value might be five. A relational selection retains true conditions, so unknown does not pass the filter.[ref]
Database aggregation has operation-specific rules. On values 2, NULL, 4, COUNT(*) counts three rows, COUNT(value) counts two non-null values and AVG(value) is three. With no input rows, COUNT returns zero while AVG and SUM return SQL NULL. Therefore a blanket rule that all database aggregation ignores SQL NULL is insufficient.[ref]

Articles by others on the same topic (1)