Используемые таблицы

CREATE TABLE city (
    ID int NOT NULL AUTO_INCREMENT,
    Name char(35NOT NULL DEFAULT '',
    CountryCode char(3NOT NULL DEFAULT '',
    District char(20NOT NULL DEFAULT '',
    Population int NOT NULL DEFAULT '0',
    PRIMARY KEY (ID),
    KEY CountryCode (CountryCode),
    CONSTRAINT city_ibfk_1 FOREIGN KEY (CountryCode) REFERENCES country (Code)
);

INSERT INTO city (
    ID, Name, CountryCode, District, Population)
VALUES (
    1'Kabul''AFG''Kabol'1780000);


                                                                                                                                                                                             
IDNameCountryCodeDistrictPopulation
1KabulAFGKabol1,780,000
2QandaharAFGQandahar237,500
3HeratAFGHerat186,800
4Mazar-e-SharifAFGBalkh127,800
5AmsterdamNLDNoord-Holland731,200
6RotterdamNLDZuid-Holland593,321
7HaagNLDZuid-Holland440,900
8UtrechtNLDUtrecht234,323
9EindhovenNLDNoord-Brabant201,843
...

Скачать базу данных для тестирования запросов.