Results for “SQL Server”
Small, practical examples. Search by task or narrow things down below.
Calculate a running total
Accumulate values in row order.
window✓ Tested
Calculate a total for each group
Postgres: Group nonmissing categories and calculate separate totals.
Postgres✓ Tested
Calculate each group’s integer percentage of the total
Postgres: Multiply before division and protect against a zero denominator.
Postgres✓ Tested
Calculate each group’s numeric spread
Postgres: Subtract MIN from MAX to report the difference between extremes.
Postgres✓ Tested
Calculate whole days between dates
Subtract Julian day values for date-only inputs.
julianday✓ Tested
Check JSONB containment
Test whether an object contains a key-value pair.
jsonb✓ Tested
Check whether text is valid JSON
Reject malformed input before processing it.
json_valid✓ Tested
Collect ordered values into an array
Build a sorted array from query rows.
array_agg✓ Tested
Combine matching rows with INNER JOIN
Read product names with their matching stock values.
INNER JOIN✓ Tested
Combine results while retaining duplicates
Postgres: UNION ALL does not spend work removing equal rows.
Postgres✓ Tested
Combine results without duplicates
Merge compatible result sets with UNION.
UNION✓ Tested
Combine text values with a separator
Postgres: Use the concatenation operator supported by the selected SQL dialect.
Postgres✓ Tested