This advanced SQL exercise is part of the book: Advanced SQL – Practical Techniques and Use-Cases, which includes 100 day-to-day SQL challenges (and solutions), need-to-know advanced features, and key concepts.
Given a hierarchical table, which displays various cities and regions in the State of Israel. For example – the Northern region (serial number 423) is located in the State of Israel (serial number 938), the city of Haifa (serial number 261) is located in the Northern region (serial number 423), and so on.
CREATE TABLE IsraelRegions (regionID int, regionName varchar(25), InRegion int) GO