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

PASS Data Community Summit 2025 Slides and Code

By

Thank you for attending my PASS Summit 2025 session Answering the Auditor’s Call with...

Tech Conferences and Expanding Your View

By

Tech conferences aren't just for networking and learning how to address a problem you're...

Managing subscribers, creating newsletters

By

When I created the website on WordPress, I was expecting all the features I...

Read the latest Blogs

Forums

Getting the Schema for Tables

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Getting the Schema for Tables

An Unexciting Exciting Release

By Steve Jones - SSC Editor

Comments posted to this topic are about the item An Unexciting Exciting Release

UNLOGGED Tables in PostgreSQL: When Speed Matters More Than Durability

By Chandan Shukla

Comments posted to this topic are about the item UNLOGGED Tables in PostgreSQL: When...

Visit the forum

Question of the Day

Getting the Schema for Tables

What happens when I run this on SQL Server 2022 in the AdventureWorks2022 database?

SELECT OBJECT_DEFINITION (OBJECT_ID(N'Person.Person')) AS [Object Definition]; 
GO 

See possible answers