Will Warren


SQL Script for Provinces and Territories of Canada


I made this simple SQL script to insert all the provinces of Canada. I’m posting it on here in case I need it in the future, and so anyone else that might find it useful can download it.

CREATE TABLE IF NOT EXISTS provinces (
	`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
	`name` VARCHAR(100),
	`abbrev` CHAR(2)
);

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Alberta', 'AB');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'British Columbia', 'BC');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Manitoba', 'MB');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'New Brunswick', 'NB');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Newfoundland and Labrador', 'NL');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Northwest Territories', 'NT');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Nova Scotia', 'NS');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Nunavut', 'NU');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Ontario', 'ON');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Prince Edward Island', 'PE');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Quebec', 'QC');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Saskatchewan', 'SK');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Yukon', 'YT');

Or download it as a SQL script here: canada_provinces.sql

Please forward any spelling mistakes or errors to me, or just comment on this post.


Length: 193 words or 1 min Tags: database, projects

Comments

comments powered by Disqus