Results for “lcm”
Small, practical examples. Search by task or narrow things down below.
Divide an ordered result into numbered buckets
SQL Server: NTILE distributes rows across buckets; include a unique tie-breaker for deterministic assignment.
SQL Server✓ Tested
Enforce a bounded numeric range
SQL Server: A named CHECK constraint keeps numeric values inside an inclusive interval.
SQL Server✓ Tested
Enforce a relationship between two columns
SQL Server: A row-level CHECK can require a start value to be no greater than an end value.
SQL Server✓ Tested
Enforce uniqueness with a dedicated index
SQL Server: A unique index rejects a duplicate combination independently of query plans.
SQL Server✓ Tested
Expose a reusable filtered view
SQL Server: A view stores a query definition rather than a snapshot of its rows.
SQL Server✓ Tested
Filter by a numeric comparison
SQL Server: Keep rows whose quantity exceeds a chosen threshold.
SQL Server✓ Tested
Filter groups after aggregation
SQL Server: Use HAVING to test a group’s calculated total.
SQL Server✓ Tested
Filter rows before grouping
SQL Server: WHERE limits the rows contributing to the aggregate; it differs from filtering completed groups with HAVING.
SQL Server✓ Tested
Find missing values with IS NULL
SQL Server: Use IS NULL rather than equality to test for missing data.
SQL Server✓ Tested
Find parents whose every child meets a rule
SQL Server: Combine existence with the absence of a violating child to exclude parents with no children.
SQL Server✓ Tested
Find parents with at least two child rows
SQL Server: Use a correlated count when testing a per-parent threshold.
SQL Server✓ Tested
Find records without any related rows
SQL Server: NOT EXISTS avoids the NULL pitfalls of NOT IN when the subquery column can be missing.
SQL Server✓ Tested