Vancouver Web Consultants

March 5, 2009

MySQL table for Canadian Provinces with ISO code

Filed under: MySQL Snippets — Tags: , , — Nelson @ 12:53 pm

Here are some handy MySQL statements to create a table of Canadian provinces and territories with their ISO abbreviations. Handy for drop-down lists and the like. We’ve also posted SQL statements for a MySQL table of US States, and an Australian one as well. Enjoy!

CREATE TABLE `geo_provinces_ca` (
  `id` int(11) NOT NULL DEFAULT '0',
  `printable_name` char(40) collate utf8_unicode_ci NOT NULL,
  `iso` char(2) collate utf8_unicode_ci NOT NULL,
  PRIMARY KEY  (`id`)
)i;
 
INSERT INTO `geo_provinces_ca` (`id`,`printable_name`,`iso`)
VALUES
	(NULL,'Ontario','ON'),
	(NULL,'Quebec','QC'),
	(NULL,'Nova Scotia','NS'),
	(NULL,'New Brunswick','NB'),
	(NULL,'Manitoba','MB'),
	(NULL,'British Columbia','BC'),
	(NULL,'Prince Edward Island','PE'),
	(NULL,'Saskatchewan','SK'),
	(NULL,'Alberta','AB'),
	(NULL,'Newfoundland and Labrador','NL'),
	(NULL,'Northwest Territories','NT'),
	(NULL,'Yukon','YT'),
	(NULL,'Nunavut','NU');

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress