How do a default value and a Nullable Column work together in one table? Two short scripts from an interview panel show exactly what SQL Server does.
Can We Have NULL Value in Primary Key? – Interview Question of the Week #075
Can we have a NULL value in primary key columns? No. The primary key has to uniquely identify each row, and NULL cannot do that. Here is why.
What is NOT NULL Constraint? – Interview Question of the Week #073
A client table full of NULL values was hurting query plans. Here is what a NOT NULL constraint is, how to add one and why it helped performance.
AND Before OR: Operator Precedence in WHERE Clauses
A report showed closed orders even though the filter said open. The reason is how SQL Server groups AND and OR.
Finding Rows That Differ Between Two Tables With EXCEPT
Use EXCEPT to find differing rows in both directions, compare selected columns, handle NULLs, and distinguish changed keys from additions.
Syncing a Lookup Table Without MERGE: Insert, Update, Delete
Three plain statements can do the job of MERGE, and each one gives you its own row count. Here is how to build it, test it and trust it.
JSON_OBJECT and JSON_ARRAY: Building JSON in SQL Server 2022
Build JSON_OBJECT and JSON_ARRAY values in SQL Server 2022, control null handling, nest arrays, and compare rowset and aggregate output.







