Created
August 22, 2019 13:04
-
-
Save slava-basko/3c9e9d199bb9a762dba5d5ffd926918f to your computer and use it in GitHub Desktop.
SELECT countries alpha-3 to alpha-2
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
select CASE alpha3 | |
WHEN 'ABH' then 'AB' | |
WHEN 'AND' then 'AD' | |
WHEN 'ARE' then 'AE' | |
WHEN 'AFG' then 'AF' | |
WHEN 'ATG' then 'AG' | |
WHEN 'AIA' then 'AI' | |
WHEN 'ALB' then 'AL' | |
WHEN 'ARM' then 'AM' | |
WHEN 'AGO' then 'AO' | |
WHEN 'ATA' then 'AQ' | |
WHEN 'ARG' then 'AR' | |
WHEN 'ASM' then 'AS' | |
WHEN 'AUT' then 'AT' | |
WHEN 'AUS' then 'AU' | |
WHEN 'ABW' then 'AW' | |
WHEN 'ALA' then 'AX' | |
WHEN 'AZE' then 'AZ' | |
WHEN 'BIH' then 'BA' | |
WHEN 'BRB' then 'BB' | |
WHEN 'BGD' then 'BD' | |
WHEN 'BEL' then 'BE' | |
WHEN 'BFA' then 'BF' | |
WHEN 'BGR' then 'BG' | |
WHEN 'BHR' then 'BH' | |
WHEN 'BDI' then 'BI' | |
WHEN 'BEN' then 'BJ' | |
WHEN 'BLM' then 'BL' | |
WHEN 'BMU' then 'BM' | |
WHEN 'BRN' then 'BN' | |
WHEN 'BOL' then 'BO' | |
WHEN 'BES' then 'BQ' | |
WHEN 'BRA' then 'BR' | |
WHEN 'BHS' then 'BS' | |
WHEN 'BTN' then 'BT' | |
WHEN 'BVT' then 'BV' | |
WHEN 'BWA' then 'BW' | |
WHEN 'BLR' then 'BY' | |
WHEN 'BLZ' then 'BZ' | |
WHEN 'CAN' then 'CA' | |
WHEN 'CCK' then 'CC' | |
WHEN 'COD' then 'CD' | |
WHEN 'CAF' then 'CF' | |
WHEN 'COG' then 'CG' | |
WHEN 'CHE' then 'CH' | |
WHEN 'CIV' then 'CI' | |
WHEN 'COK' then 'CK' | |
WHEN 'CHL' then 'CL' | |
WHEN 'CMR' then 'CM' | |
WHEN 'CHN' then 'CN' | |
WHEN 'COL' then 'CO' | |
WHEN 'CRI' then 'CR' | |
WHEN 'CUB' then 'CU' | |
WHEN 'CPV' then 'CV' | |
WHEN 'CUW' then 'CW' | |
WHEN 'CXR' then 'CX' | |
WHEN 'CYP' then 'CY' | |
WHEN 'CZE' then 'CZ' | |
WHEN 'DEU' then 'DE' | |
WHEN 'DJI' then 'DJ' | |
WHEN 'DNK' then 'DK' | |
WHEN 'DMA' then 'DM' | |
WHEN 'DOM' then 'DO' | |
WHEN 'DZA' then 'DZ' | |
WHEN 'ECU' then 'EC' | |
WHEN 'EST' then 'EE' | |
WHEN 'EGY' then 'EG' | |
WHEN 'ESH' then 'EH' | |
WHEN 'ERI' then 'ER' | |
WHEN 'ESP' then 'ES' | |
WHEN 'ETH' then 'ET' | |
WHEN 'FIN' then 'FI' | |
WHEN 'FJI' then 'FJ' | |
WHEN 'FLK' then 'FK' | |
WHEN 'FSM' then 'FM' | |
WHEN 'FRO' then 'FO' | |
WHEN 'FRA' then 'FR' | |
WHEN 'GAB' then 'GA' | |
WHEN 'GBR' then 'GB' | |
WHEN 'GRD' then 'GD' | |
WHEN 'GEO' then 'GE' | |
WHEN 'GUF' then 'GF' | |
WHEN 'GGY' then 'GG' | |
WHEN 'GHA' then 'GH' | |
WHEN 'GIB' then 'GI' | |
WHEN 'GRL' then 'GL' | |
WHEN 'GMB' then 'GM' | |
WHEN 'GIN' then 'GN' | |
WHEN 'GLP' then 'GP' | |
WHEN 'GNQ' then 'GQ' | |
WHEN 'GRC' then 'GR' | |
WHEN 'SGS' then 'GS' | |
WHEN 'GTM' then 'GT' | |
WHEN 'GUM' then 'GU' | |
WHEN 'GNB' then 'GW' | |
WHEN 'GUY' then 'GY' | |
WHEN 'HKG' then 'HK' | |
WHEN 'HMD' then 'HM' | |
WHEN 'HND' then 'HN' | |
WHEN 'HRV' then 'HR' | |
WHEN 'HTI' then 'HT' | |
WHEN 'HUN' then 'HU' | |
WHEN 'IDN' then 'ID' | |
WHEN 'IRL' then 'IE' | |
WHEN 'ISR' then 'IL' | |
WHEN 'IMN' then 'IM' | |
WHEN 'IND' then 'IN' | |
WHEN 'IOT' then 'IO' | |
WHEN 'IRQ' then 'IQ' | |
WHEN 'IRN' then 'IR' | |
WHEN 'ISL' then 'IS' | |
WHEN 'ITA' then 'IT' | |
WHEN 'JEY' then 'JE' | |
WHEN 'JAM' then 'JM' | |
WHEN 'JOR' then 'JO' | |
WHEN 'JPN' then 'JP' | |
WHEN 'KEN' then 'KE' | |
WHEN 'KGZ' then 'KG' | |
WHEN 'KHM' then 'KH' | |
WHEN 'KIR' then 'KI' | |
WHEN 'COM' then 'KM' | |
WHEN 'KNA' then 'KN' | |
WHEN 'PRK' then 'KP' | |
WHEN 'KOR' then 'KR' | |
WHEN 'KWT' then 'KW' | |
WHEN 'CYM' then 'KY' | |
WHEN 'KAZ' then 'KZ' | |
WHEN 'LAO' then 'LA' | |
WHEN 'LBN' then 'LB' | |
WHEN 'LCA' then 'LC' | |
WHEN 'LIE' then 'LI' | |
WHEN 'LKA' then 'LK' | |
WHEN 'LBR' then 'LR' | |
WHEN 'LSO' then 'LS' | |
WHEN 'LTU' then 'LT' | |
WHEN 'LUX' then 'LU' | |
WHEN 'LVA' then 'LV' | |
WHEN 'LBY' then 'LY' | |
WHEN 'MAR' then 'MA' | |
WHEN 'MCO' then 'MC' | |
WHEN 'MDA' then 'MD' | |
WHEN 'MNE' then 'ME' | |
WHEN 'MAF' then 'MF' | |
WHEN 'MDG' then 'MG' | |
WHEN 'MHL' then 'MH' | |
WHEN 'MKD' then 'MK' | |
WHEN 'MLI' then 'ML' | |
WHEN 'MMR' then 'MM' | |
WHEN 'MNG' then 'MN' | |
WHEN 'MAC' then 'MO' | |
WHEN 'MNP' then 'MP' | |
WHEN 'MTQ' then 'MQ' | |
WHEN 'MRT' then 'MR' | |
WHEN 'MSR' then 'MS' | |
WHEN 'MLT' then 'MT' | |
WHEN 'MUS' then 'MU' | |
WHEN 'MDV' then 'MV' | |
WHEN 'MWI' then 'MW' | |
WHEN 'MEX' then 'MX' | |
WHEN 'MYS' then 'MY' | |
WHEN 'MOZ' then 'MZ' | |
WHEN 'NAM' then 'NA' | |
WHEN 'NCL' then 'NC' | |
WHEN 'NER' then 'NE' | |
WHEN 'NFK' then 'NF' | |
WHEN 'NGA' then 'NG' | |
WHEN 'NIC' then 'NI' | |
WHEN 'NLD' then 'NL' | |
WHEN 'NOR' then 'NO' | |
WHEN 'NPL' then 'NP' | |
WHEN 'NRU' then 'NR' | |
WHEN 'NIU' then 'NU' | |
WHEN 'NZL' then 'NZ' | |
WHEN 'OMN' then 'OM' | |
WHEN 'OST' then 'OS' | |
WHEN 'PAN' then 'PA' | |
WHEN 'PER' then 'PE' | |
WHEN 'PYF' then 'PF' | |
WHEN 'PNG' then 'PG' | |
WHEN 'PHL' then 'PH' | |
WHEN 'PAK' then 'PK' | |
WHEN 'POL' then 'PL' | |
WHEN 'SPM' then 'PM' | |
WHEN 'PCN' then 'PN' | |
WHEN 'PRI' then 'PR' | |
WHEN 'PSE' then 'PS' | |
WHEN 'PRT' then 'PT' | |
WHEN 'PLW' then 'PW' | |
WHEN 'PRY' then 'PY' | |
WHEN 'QAT' then 'QA' | |
WHEN 'REU' then 'RE' | |
WHEN 'ROU' then 'RO' | |
WHEN 'SRB' then 'RS' | |
WHEN 'RUS' then 'RU' | |
WHEN 'RWA' then 'RW' | |
WHEN 'SAU' then 'SA' | |
WHEN 'SLB' then 'SB' | |
WHEN 'SYC' then 'SC' | |
WHEN 'SDN' then 'SD' | |
WHEN 'SWE' then 'SE' | |
WHEN 'SGP' then 'SG' | |
WHEN 'SHN' then 'SH' | |
WHEN 'SVN' then 'SI' | |
WHEN 'SJM' then 'SJ' | |
WHEN 'SVK' then 'SK' | |
WHEN 'SLE' then 'SL' | |
WHEN 'SMR' then 'SM' | |
WHEN 'SEN' then 'SN' | |
WHEN 'SOM' then 'SO' | |
WHEN 'SUR' then 'SR' | |
WHEN 'SSD' then 'SS' | |
WHEN 'STP' then 'ST' | |
WHEN 'SLV' then 'SV' | |
WHEN 'SXM' then 'SX' | |
WHEN 'SYR' then 'SY' | |
WHEN 'SWZ' then 'SZ' | |
WHEN 'TCA' then 'TC' | |
WHEN 'TCD' then 'TD' | |
WHEN 'ATF' then 'TF' | |
WHEN 'TGO' then 'TG' | |
WHEN 'THA' then 'TH' | |
WHEN 'TJK' then 'TJ' | |
WHEN 'TKL' then 'TK' | |
WHEN 'TLS' then 'TL' | |
WHEN 'TKM' then 'TM' | |
WHEN 'TUN' then 'TN' | |
WHEN 'TON' then 'TO' | |
WHEN 'TUR' then 'TR' | |
WHEN 'TTO' then 'TT' | |
WHEN 'TUV' then 'TV' | |
WHEN 'TWN' then 'TW' | |
WHEN 'TZA' then 'TZ' | |
WHEN 'UKR' then 'UA' | |
WHEN 'UGA' then 'UG' | |
WHEN 'UMI' then 'UM' | |
WHEN 'USA' then 'US' | |
WHEN 'URY' then 'UY' | |
WHEN 'UZB' then 'UZ' | |
WHEN 'VAT' then 'VA' | |
WHEN 'VCT' then 'VC' | |
WHEN 'VEN' then 'VE' | |
WHEN 'VGB' then 'VG' | |
WHEN 'VIR' then 'VI' | |
WHEN 'VNM' then 'VN' | |
WHEN 'VUT' then 'VU' | |
WHEN 'WLF' then 'WF' | |
WHEN 'WSM' then 'WS' | |
WHEN 'YEM' then 'YE' | |
WHEN 'MYT' then 'YT' | |
WHEN 'ZAF' then 'ZA' | |
WHEN 'ZMB' then 'ZM' | |
WHEN 'ZWE' then 'ZW' | |
ELSE 'Undefined' | |
END as alpha2 | |
from countries; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment