This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
Gouache painting: a row of wooden crates of graduated widths along a barn wall, a chute pouring mangoes into the first and widest crate, one crate painted vermilion

Data Binning in T-SQL: Fixed Width, NTILE, CASE, DATE_BUCKET

October 13, 2023
Pinal Dave
SQL Tips and Tricks
Ranking Functions, SQL CASE, SQL DateTime, SQL Group By, SQL Scripts

Data binning turns a column of numbers into a few groups you can count and chart. This post runs four T-SQL methods on the same orders on SQL Server 2025: fixed width, NTILE, CASE ranges and DATE_BUCKET. It shows what each method tells you and one trap with BETWEEN.

Read More
Five wooden trugs of carrots sorted by length at the end of a vegetable bed, heaped to different heights.

Histogram Buckets in T-SQL: Counting Values per Range

October 12, 2023
Pinal Dave
SQL Tips and Tricks
Data Visualization, SQL Joins, SQL Scripts, SQL Server

Create histogram buckets in T-SQL with fixed widths or explicit ranges, retain empty buckets, and display scaled text bars.

Read More
A pear tree trained flat against a brick wall, a finger tracing one branch from the trunk to a single pear.

Materialized Path Hierarchies: Storing the Path as a String

August 28, 2023
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Server, SQL String, SQL Table Operation

Build a materialized path hierarchy in T-SQL, query descendants, calculate depth, and move a subtree without creating cycles.

Read More
Gouache painting: a frosted-glass window over a market stall, fruit shapes blurred behind it, one vermilion pomegranate seen sharp and clear

Masking Functions in SQL Server: What Each One Shows

August 2, 2023
Pinal Dave
SQL Tips and Tricks
SQL Column, SQL Scripts, SQL Server 2022, SQL Server Security

Dynamic data masking hides values at query time, and the masking functions decide what a reader still sees. This post tests default, email, partial, random and datetime on SQL Server 2025 and shows what each one returns. It also covers adding and dropping a mask on an existing column.

Read More
The Two Doors, Two Guards Puzzle

SQL SERVER – The Two Doors, Two Guards Puzzle

July 28, 2023
Pinal Dave
SQL Puzzle
SQL Scripts

I came across a puzzle about “The Two Doors, Two Guards,” popularly known as the “Two Doors Riddle” or the “Heaven and Hell Riddle”.

Read More
Gouache painting of ten small terracotta pots of young herbs in a row on a potting bench, one pot vermilion.

Go Programming Language: 10 Interview Questions With Tested Answers

July 7, 2023
Pinal Dave
SQL Tips and Tricks
Best Practices, Go, SQL Scripts

The Go programming language is small, so ten questions cover most of an interview. This post answers each one in plain words with a tiny program. Every program was run twice on Go 1.27.1, and the real output is shown.

Read More
CumulativeTotalCalculation

SQL SERVER Challenge – Cumulative Total Calculation

June 16, 2023
Pinal Dave
SQL Interview Questions and Answers
Contest, CTE, Ranking Functions, SQL Scripts, SQL Sub Query

Today we will see a very interesting SQL SERVER Challenge about Cumulative Total Calculation. During a recent Comprehensive Database Performance Health Check.

Read More
Previous 1 2 3 4 5 … 365 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com