Results for “exec form”
Small, practical examples. Search by task or narrow things down below.
Distinguish row count from non-null value count
SQL: COUNT(*) includes every row while COUNT(column) skips NULL values.
SQL✓ Tested
Divide an ordered result into numbered buckets
SQL: NTILE distributes rows across buckets; include a unique tie-breaker for deterministic assignment.
SQL✓ Tested
Enforce a bounded numeric range
SQL: A named CHECK constraint keeps numeric values inside an inclusive interval.
SQL✓ Tested
Enforce a relationship between two columns
SQL: A row-level CHECK can require a start value to be no greater than an end value.
SQL✓ Tested
Enforce uniqueness with a dedicated index
SQL: A unique index rejects a duplicate combination independently of query plans.
SQL✓ Tested
Expose a reusable filtered view
SQL: A view stores a query definition rather than a snapshot of its rows.
SQL✓ Tested
Filter aggregate groups
Keep only categories with multiple products.
HAVING✓ Tested
Filter by a numeric comparison
SQL: Keep rows whose quantity exceeds a chosen threshold.
SQL✓ Tested
Filter groups after aggregation
SQL: Use HAVING to test a group’s calculated total.
SQL✓ Tested
Filter rows before grouping
SQL: WHERE limits the rows contributing to the aggregate; it differs from filtering completed groups with HAVING.
SQL✓ Tested
Filter rows with WHERE
Keep products below a chosen price.
WHERE✓ Tested
Find missing values with IS NULL
SQL: Use IS NULL rather than equality to test for missing data.
SQL✓ Tested