T-SQL Challenges

Technical Article

TSQL Challenge 28 - SELECT TOP N articles from each category from a SQL Server 2000 database

  • Article

The challenge is to write a query that returns the articles to be displayed in the home page of the website. N number of articles from each category is to be selected where N is configured in the Categories table. Each category should select the most recent N articles. ArticleID can be used to identify the most recent articles. An article with a higher number indicates a more recent article.

2010-04-19

2,022 reads

External Article

Celko's SQL Stumper: The Class Scheduling Problem

  • Article

What can we use in SQL instead of E. F. Codd's T theta operators for best-fit? Joe Celko returns with another puzzle that isn't new, in fact it already features “Swedish”, “Croatian” and “Colombian” solutions in chapter 17 of Joe's 'SQL for Smarties' book. These were all written before CTEs or the new WINDOW functions. Is there now a better solution? Was there one even then? We leave it to the readers to provide the answer!

2010-01-27

1,535 reads

Technical Article

TSQL Challenge 21 - Reading, recognizing and processing graphical representation of digits.

  • Article

Here is a challenge that takes you away from those repetitive boring type of queries that you write over and over again, several times a day. All of us, the database people, are familiar with thinking in set based manner as well as row by row style. Here is something that is very interesting where you might need to process records in a 'three-line-at-a-time' fashion.

2010-01-11

2,826 reads

Blogs

Why Optimize CPU for RDS SQL Server is a game changer

By

One feature that I have been waiting for years! The new announcement around optimize...

Performance tuning KubeVirt for SQL Server

By

Following on from my last post about Getting Started With KubeVirt & SQL Server,...

T-SQL Tuesday #193 – A Note to Your Past, and a Warning from Your Future

By

I haven’t posted in a while (well, not here at least since I’ve been...

Read the latest Blogs

Forums

Change Tracking – Troubleshooting

By Phil Parkin

I have change tracking configured in several databases, in QA and production environments, and...

is there a no code way to limit an ssis extract from excel to the 1st 21 rows?

By stan

is there a no code way to limit an ssis extract from excel to...

Pivot but preserve all rows on Aggregate column

By getsaby

Hello Need help in pivoting this data set, the Pivot takes MIN/MAX on a...

Visit the forum

Question of the Day

What is the PRODUCT

In SQL Server 2025, what does this return?

CREATE TABLE Numbers
( n INT)
GO
INSERT dbo.Numbers
(
n
)
VALUES
(1), (2), (3)
GO
SELECT PRODUCT(n)
FROM dbo.Numbers

See possible answers