T-SQL

Navigating Trees With CTE

  • Article

Introduction This article shows how common table expressions (CTE) in SQL Server are naturally suited for navigating trees, such as finding its longest path, or diameter. Recall that a tree is an undirected graph where unique paths exist between any two nodes (i.e. vertices). Any node may be selected as its top node, with its […]

4.8 (5)

2021-04-19

4,833 reads

Blogs

Goal Progress for July 2021

By

I set goals at the beginning of the year, and I’m tracking my progress...

Data Modeling at your fingertips

By

(2021-July-30) A picture is worth a thousand words, the same way a visual database schema...

How to put a SQL Server Database into Recovery Pending

By

You might be asking why on earth would you want to get a database...

Read the latest Blogs

Forums

How is Throughput optimized HDD (st 1)

By kratosrules99

Hi Everyone. i am planning to shift my website to AWS   I want...

Alternative to LAG(SUM) - Can a Column Reference The Sum of the Values Above It

By John O'Connor

Hi Everyone, I'm trying to do something that seems pretty simple, but SQL Server...

Transaction log shrink w/ logshipping

By mavelzen

Hello everyone, Again with this question. 🙂 I've got a log-shipped database, and I...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers