30.4. Paths with CTE

The following queries with CTEs are due to Frédéric Brouard of France. The sample data and the narrative are so delightful that I am using his material directly.

Perhaps you never go to France. If this is the case, you may be interested by the fact that there are beautiful girls in Paris, and in Toulouse you can find a famous dish called cassoulet and a small plane construction company named Airbus. You might like to go by car from Paris to Toulouse using the speedway network. I will simplify the trip for you (if you are lost, and do not know how to pronounce your destination, it is simple. Just say “to loose” ...):

CREATE TABLE Journeys (depart_town VARCHAR(32) NOT NULL, arrival_town VARCHAR(32) NOT NULL, CHECK (depart_town ...

Get Joe Celko's SQL for Smarties, 3rd 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.