-
-
Save teacplusplus/90f913b3d07496966f067e92082b51d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `countries` ( | |
`country_id` int(11) NOT NULL, | |
`country` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL, #название страны на официальном языке страны | |
`country_english` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, #название страны на английском языке страны | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |
ALTER TABLE `countries` | |
MODIFY `country_id` int(11) NOT NULL AUTO_INCREMENT; | |
COMMIT; | |
CREATE TABLE `cities` ( | |
`city_id` int(11) NOT NULL, | |
`city` char(255) COLLATE utf8mb4_unicode_ci NOT NULL, #название города на официальном языке страны | |
`country_id` int(11) NOT NULL, | |
`city_english` varchar(255) COLLATE utf8mb4_unicode_ci, DEFAULT NULL #название города на английском языке | |
`longitude` float(10, 6) NOT NULL, #координаты города | |
`latitude` float(10, 6) NOT NULL #координаты города | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |
ALTER TABLE `cities` | |
MODIFY `city_id` int(11) NOT NULL AUTO_INCREMENT; | |
COMMIT; | |
CREATE TABLE `cities_nearest` ( | |
`city_id` int(10) NOT NULL, | |
`nearest_city_id` int(10) NOT NULL, | |
`distance` int(10) NOT NULL # расстояние между городами | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |
ALTER TABLE `cities_nearest` | |
ADD PRIMARY KEY (`city_id`,`nearest_city_id`); | |
COMMIT; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment