Skip to content

Instantly share code, notes, and snippets.

@ian29
Last active January 4, 2016 01:59
Show Gist options
  • Save ian29/8552118 to your computer and use it in GitHub Desktop.
Save ian29/8552118 to your computer and use it in GitHub Desktop.
select qs_a0,count(distinct(cast(match as text))) from
( select qs_a0,regexp_matches(left(qs_a1_lc,3), '[A-Z]*','g') as match from tmpqsadm1 ) as foo
where match <> '{""}'
group by qs_a0
order by qs_a0;
qs_a0 | count
--------------------------------------+-------
Afghanistan | 1
Akrotiri Sovereign Base Area | 1
Aland | 1
Albania | 1
Algeria | 1
American Samoa | 1
Andorra | 1
Angola | 1
Anguilla | 1
Antarctica | 1
Antigua and Barbuda | 1
Argentina | 1
Armenia | 1
Aruba | 1
Ashmore and Cartier Islands | 1
Azerbaijan | 1
Bahrain | 1
Bajo Nuevo Bank (Petrel Is.) | 1
Bangladesh | 1
Barbados | 1
Baykonur Cosmodrome | 1
Belarus | 1
België#Belgique#Belgien | 3
Belize | 1
Benin | 1
Bermuda | 1
Bhutan | 1
Bolivia | 1
Bosnia and Herzegovina | 1
Botswana | 1
British Indian Ocean Territory | 1
British Virgin Islands | 1
Brunei | 1
Bundesrepublik Deutschland | 3
Burkina Faso | 1
Burundi | 1
Cambodia | 1
Cameroon | 1
Cape Verde | 1
Caribbean Netherlands | 1
Cayman Islands | 1
Central African Republic | 1
Chad | 1
China | 2
Clipperton Island | 1
Colombia | 1
Comoros | 1
Cook Islands | 1
Coral Sea Islands | 1
Costa Rica | 1
Cuba | 1
Curaçao | 1
Danmark | 1
Democratic Republic of the Congo | 1
Dhekelia Soverign Base Area | 1
Djibouti | 1
Dominica | 1
Dominican Republic | 1
East Timor | 1
Ecuador | 1
Egypt | 1
El Salvador | 1
Equatorial Guinea | 1
Eritrea | 1
Estonia | 1
Ethiopia | 1
Falkland Islands | 1
Faroe Islands | 1
Federated States of Micronesia | 1
Fiji | 1
France | 2
French Polynesia | 1
French Southern and Antarctic Lands | 1
Gabon | 1
Gambia | 1
Gaza Strip | 1
Georgia | 1
Ghana | 1
Grenada | 1
Guam | 1
Guatemala | 1
Guernsey | 1
Guinea | 1
Guinea Bissau | 1
Guyana | 1
Haiti | 1
Heard Island and McDonald Islands | 1
Honduras | 1
Hong Kong S.A.R. | 1
Iceland | 1
India | 1
Indian Ocean Territories | 1
Indonesia | 1
Iran | 1
Iraq | 1
Ireland | 1
Isle of Man | 1
Israel | 1
Ivory Coast | 1
Jamaica | 1
Japan | 1
Jersey | 1
Jordan | 1
Kalaallit Nunaat#Grønland | 1
Kazakhstan | 1
Kenya | 1
Kiribati | 1
Kosovo | 1
Kuwait | 1
Kyrgyzstan | 1
Laos | 1
Latvija | 1
Lebanon | 1
Lesotho | 1
Liberia | 1
Libya | 1
Lietuva | 1
Luxembourg | 1
Macau S.A.R | 1
Macedonia | 1
Madagascar | 1
Magyarország | 1
Malawi | 1
Malaysia | 1
Maldives | 1
Mali | 1
Malta | 1
Marshall Islands | 1
Mauritania | 1
Mauritius | 1
Moldova | 1
Monaco | 2
Mongolia | 1
Montenegro | 1
Montserrat | 1
Morocco | 1
Mozambique | 1
Myanmar | 1
Namibia | 1
Nauru | 1
Nederland | 1
Nepal | 1
Netherlands | 1
New Caledonia | 1
Nicaragua | 1
Niger | 1
Nigeria | 1
Niue | 1
Norfolk Island | 1
Norge | 1
North Korea | 1
Northern Cyprus | 1
Northern Mariana Islands | 1
Norway | 1
Null Island | 1
Oman | 1
Pakistan | 1
Palau | 1
Panama | 1
Papua New Guinea | 1
Paraguay | 1
Peru | 1
Philippines | 1
Pitcairn Islands | 1
Portugal | 1
Qatar | 1
Republic of the Congo | 1
Republika Hrvatska | 3
Republika Srbija | 1
România | 1
Rwanda | 1
Rzeczpospolita Polska | 1
S. Sudan | 1
Saint Barthelemy | 1
Saint Helena | 1
Saint Kitts and Nevis | 1
Saint Lucia | 1
Saint Martin | 1
Saint Pierre and Miquelon | 1
Saint Vincent and the Grenadines | 1
Samoa | 1
San Marino | 1
Sao Tome and Principe | 1
Saudi Arabia | 1
Scarborough Reef | 1
Senegal | 1
Serranilla Bank | 1
Seychelles | 1
Siachen Glacier | 1
Sierra Leone | 1
Singapore | 1
Sint Maarten | 1
Slovenia | 1
Slovensko | 1
Solomon Islands | 1
Somalia | 1
Somaliland | 1
South Georgia and the Islands | 1
South Korea | 1
Spratly Is. | 1
Sri Lanka | 1
Sudan | 1
Suomi#Finland | 1
Suriname | 1
Sverige | 1
Swaziland | 1
Syria | 1
Taiwan | 1
Tajikistan | 1
Thailand | 1
The Bahamas | 1
Togo | 1
Tonga | 1
Trinidad and Tobago | 1
Tunisia | 1
Turkey | 1
Turkmenistan | 1
Turks and Caicos Islands | 1
Tuvalu | 1
US Naval Base Guantanamo Bay | 1
Uganda | 1
United Arab Emirates | 1
United Kingdom | 2
United Republic of Tanzania | 1
United States Minor Outlying Islands | 1
United States Virgin Islands | 1
Uruguay | 1
Uzbekistan | 1
Vanuatu | 1
Venezuela | 1
Vietnam | 1
Wallis and Futuna | 1
West Bank | 1
Western Sahara | 1
Yemen | 1
Zambia | 1
Zimbabwe | 1
Österreich | 1
Česká republika | 1
Ελλάδα | 1
Κύπρος | 1
Україна | 1
България | 13
| 4
(244 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment