Date conversion styles define how incoming text becomes a date. Compare month-first and day-first interpretations without guessing. Keep invalid dates separate from missing input.
Finding Duplicates Before Adding a Unique Constraint
A unique constraint fails on the first duplicate it meets and tells you about only one. Here is how to list them all and clean up safely.
CASE Sort Priority: Put Business Order Before Alphabetical Order
CASE sort priority makes the queue policy explicit. Map known statuses to numeric ranks and keep missing or unfamiliar labels visible. Finish tied ranks with a unique key.
LAG IGNORE NULLS: Read the Previous Available Value
LAG IGNORE NULLS reads the previous non-NULL value within an ordered partition. These examples distinguish skipped rows, missing previous values and the supplied default.
Decimal Division: Inspect Precision Before the Final Cast
Decimal division derives its own precision and scale before your final cast. Compare wide and bounded inputs, then test rounding and valid numeric ranges.
LEFT JOIN ON Clause: Conditions Decide Matches, Not Rows
Why a condition in ON keeps every customer, why a left-side condition removes nobody, and how one WHERE quietly undoes two LEFT JOINs.
Percent Change Between Rows: Handling Zero and NULL Safely
One zero month can kill a revenue report. Here is how to get percent change without errors or lies.







