-- *** before: ***
-- a row series or a hierarchy walk was a loop in the application,
-- or Oracle's own CONNECT BY
-- *** in version 1999: ***
WITH RECURSIVE Decade(Year) AS (
SELECT 1900
UNION ALL
SELECT Year + 10 FROM Decade WHERE Year < 1990
)
SELECT Decade.Year, COUNT(country.Code) AS Independent
FROM Decade
LEFT JOIN country
ON country.IndepYear >= Decade.Year
AND country.IndepYear < Decade.Year + 10
GROUP BY Decade.Year
-- Support: PostgreSQL 8.4, SQLite 3.8.3, MySQL 8.0 and Firebird 2.1
-- use exactly this spelling. MS SQL Server 2005 and Oracle 11.2
-- recurse with a plain WITH and no RECURSIVE keyword; Oracle keeps
-- CONNECT BY as well. Access cannot do it.
| Year | Independent |
| 1900 | 7 |
| 1910 | 9 |
| 1920 | 5 |
| 1930 | 2 |
| 1940 | 15 |
| 1950 | 11 |
| 1960 | 43 |
| 1970 | 24 |
| 1980 | 6 |
| 1990 | 26 |