Use Bayesian average in SQL Server with practical examples, clear checks, and the limits you need before changing your database.
Finding the Most Frequent Value per Group in T-SQL
Find the most frequent value in each group, choose a tie policy, and compare categorical modes with averages and numeric percentiles.
Reordering a List in SQL Server: Move One Row, Write One Row
Reordering a list in SQL Server means changing a sort key, and the best design writes the fewest rows. This post compares three designs for dragging an item to a new place: renumber everything, shift the rows in between, and leave gaps. Each one is measured by rows written on a list of 1,000 items. Every result comes from SQL Server 2025.
The WINDOW Clause: Name a Window Once and Reuse It
Use the WINDOW clause to reuse partition and order rules, extend named windows with frames, and keep SQL Server calculations consistent.
Merging Overlapping Date Ranges Into Continuous Periods
Use running end dates when merging overlapping ranges, choose boundary rules, and return continuous periods without losing nested intervals.
MERGE Statement Quiz: What If Two Source Rows Match One Target?
This MERGE Statement Quiz asks what happens when two source rows match one target row. The answer is error 8672, and the whole statement fails. A tested script shows the error, the fix with ROW_NUMBER and the same change written as UPDATE plus INSERT.
Ranking Functions Quiz: ROW_NUMBER, RANK or DENSE_RANK?
This Ranking Functions Quiz uses two tied scores to ask what number the next student gets from ROW_NUMBER, RANK and DENSE_RANK. The answer is 3, 3 and 2. A tested script proves it and replaces a cursor loop with one query.







