FIND YOUR NEXT FEW LINES

Results for “SQL Server”

Small, practical examples. Search by task or narrow things down below.

502 snippets foundClear filters
SQL ServerRelationships & missing data

Include zero counts for missing relationships

SQL Server: Count the non-null child key after a left join so a missing relationship produces zero.

SQL Server✓ Tested
SQL ServerBulk changes & set operations

Increment a stored value in the database

SQL Server: An in-database arithmetic update avoids a separate application read-modify-write step.

SQL Server✓ Tested
SQL ServerBulk changes & set operations

Insert only keys absent from a destination

SQL Server: NOT EXISTS supports a set-based missing-row insert in a single-writer example.

SQL Server✓ Tested
SQL ServerRelationships & missing data

Join a parent to pre-aggregated totals

SQL Server: Aggregate the child rows first to produce at most one joined row per parent.

SQL Server✓ Tested
SQL ServerGetting Started

Join related rows from two tables

SQL Server: Match a category key to its display label with an explicit join condition.

SQL Server✓ Tested
SQL ServerRelationships & missing data

Join through a lookup table

SQL Server: Use explicit aliases and join keys when enriching records through two relationships.

SQL Server✓ Tested
SQL ServerConstraints & defaults

Keep children while clearing a deleted relationship

SQL Server: ON DELETE SET NULL requires a nullable foreign-key column.

SQL Server✓ Tested
SQL ServerRelationships & missing data

Keep parent rows while filtering joined children

SQL Server: Put a child filter in ON when unmatched parents must remain in the result.

SQL Server✓ Tested
SQL ServerGetting Started

Keep rows matching a condition

SQL Server: Use WHERE to select rows with a particular category.

SQL Server✓ Tested
SQL ServerRelationships & missing data

List unordered pairs without duplicate reversals

SQL Server: Join using an increasing key comparison to omit self-pairs and reversed duplicates.

SQL Server✓ Tested
SQL ServerConstraints & defaults

Make a pair of columns unique together

SQL Server: A composite primary key permits repeated individual values while forbidding a duplicate combination.

SQL Server✓ Tested
SQL ServerText cleanup & matching

Match a known text prefix

SQL Server: A percent wildcard matches zero or more characters following the prefix.

SQL Server✓ Tested