Results for “SQL Server”
Small, practical examples. Search by task or narrow things down below.
Combine results while retaining duplicates
SQL Server: UNION ALL does not spend work removing equal rows.
SQL Server✓ Tested
Combine text values with a separator
SQL Server: Use the concatenation operator supported by the selected SQL dialect.
SQL Server✓ Tested
Commit multiple related changes together
SQL Server: The first transaction prepares the fixtures. The second commits both updates as one unit.
SQL Server✓ Tested
Compare a row with its own group average
SQL Server: A correlated aggregate computes a different comparison value for each group.
SQL Server✓ Tested
Compute an integer weighted average
SQL Server: Multiply before summing and guard a zero total weight with NULLIF.
SQL Server✓ Tested
Copy selected rows into another table
SQL Server: INSERT SELECT performs a set-based copy with an explicit destination column list.
SQL Server✓ Tested
Count distinct values within a result
SQL Server: COUNT DISTINCT counts distinct non-null values.
SQL Server✓ Tested
Count rows satisfying separate conditions
SQL Server: SUM over CASE expressions calculates several conditional counts in one scan.
SQL Server✓ Tested
Count the rows in a table
SQL Server: COUNT(*) includes every row, including rows with NULL columns.
SQL Server✓ Tested
Create a table and insert its first row
SQL Server: Define column types and a primary key, then insert one row using an explicit column list.
SQL Server✓ Tested
Create an index for an equality filter
SQL Server: A nonunique index can support lookups on a frequently filtered column.
SQL Server✓ Tested
Create an index matching filter and ordering columns
SQL Server: Place the equality-filter column before the ordering column in this composite index.
SQL Server✓ Tested