Chapter 27

Graphs in SQL

Abstract

Graphs are important because they are a general way to represent many different types of data and their relationships. SQL was not meant to be a graph language (there are graph databases today), but you can model graphs in SQL.

Keywords

Graph theory

Indegree

Outdegree

Adjacency list

John Gilson

Edge

Node

Tree

Directed graph

Acyclic graph

Nonreconvergent

Reconvergent

Reachable nodes

Source

Sink

Isolated nodes

Internal nodes

Path

Adjacency matrix

Taxi cab geometry

Equivalence class

Cliques

The terminology in graph theory pretty much explains itself; if it does not, you can read some of the books suggested in the appendix for graph theory. Graphs are important because they are a general way to represent many ...

Get Joe Celko's SQL for Smarties, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.