Results for “CMD”
Small, practical examples. Search by task or narrow things down below.
Find parents with at least two child rows
SQL Server: Use a correlated count when testing a per-parent threshold.
SQL Server✓ Tested
Find records without any related rows
SQL Server: NOT EXISTS avoids the NULL pitfalls of NOT IN when the subquery column can be missing.
SQL Server✓ Tested
Find rows in the first result but not the second
SQL Server: EXCEPT calculates a distinct result-set difference.
SQL Server✓ Tested
Find rows shared by two query results
SQL Server: INTERSECT compares complete selected rows and removes duplicates.
SQL Server✓ Tested
Find the final day of a month
Use EOMONTH without manually calculating month length.
EOMONTH✓ Tested
Find the index of an array item
PowerShell: Array.IndexOf returns -1 when the requested item is absent.
PowerShell✓ Tested
Find the number of days in a month
PowerShell: DaysInMonth handles leap-year February correctly.
PowerShell✓ Tested
Find the second-highest distinct value
SQL Server: Select the maximum below the overall maximum to skip ties at the top.
SQL Server✓ Tested
Format a bounded duration as hours minutes and seconds
PowerShell: TimeSpan can format duration components with escaped separators.
PowerShell✓ Tested
Format a date without locale ambiguity
Parse an ISO date and format it consistently.
date✓ Tested
Generate a bounded sequence recursively
Use a recursive CTE with a recursion limit.
recursive CTE✓ Tested
Generate every combination of two sets
SQL Server: CROSS JOIN creates one result per possible pair, so the output size is the product of the input sizes.
SQL Server✓ Tested