Category: DBA Engineering
SQL Server engineering topics focused on how the database engine behaves, including query logic, internals, execution patterns, and design decisions that affect performance and correctness.
-
RAND() vs NEWID() in SQL Server
Most people searching for “random numbers in SQL Server” want one of two things: SQL Server gives you two common tools for this: RAND() and NEWID(). They solve different problems, and confusion usually starts when they are treated as interchangeable. This post shows how to use both, starting with simple examples, and explains why they…
-
Understanding WHERE 1=1 and WHERE 1=2 in SQL Queries
In SQL, you will often see queries written using WHERE 1=1 or WHERE 1=2. At first glance, both look pointless. One is always true, the other always false. In practice, both are deliberate patterns used for query construction and control, not filtering logic. They exist to make SQL safer, easier to manipulate, and more predictable…