-- *** 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 recurses with a plain
-- WITH and no RECURSIVE keyword; Oracle understands WITH RECURSIVE
-- since 11.2 and keeps CONNECT BY. Access cannot do it.