ALTER TABLE users ADD COLUMN firstname varchar(60);
ALTER TABLE users ADD COLUMN lastname varchar(60);
ALTER TABLE users ADD COLUMN address2 text;
ALTER TABLE users ADD COLUMN ccode char(2);
ALTER TABLE users ALTER COLUMN ccode SET DEFAULT 'US';
UPDATE USERS SET ccode='US',firstname=realname WHERE firstname is null;

CREATE TABLE country_code (
	country_name varchar(80),
	ccode char(2) primary key
);

INSERT INTO country_code VALUES ("Afghanistan",'AF');
INSERT INTO country_code VALUES ("Åland Islands",'AX');
INSERT INTO country_code VALUES ("Albania",'AL');
INSERT INTO country_code VALUES ("Algeria",'DZ');
INSERT INTO country_code VALUES ("American Samoa",'AS');
INSERT INTO country_code VALUES ("Andorra",'AD');
INSERT INTO country_code VALUES ("Angola",'AO');
INSERT INTO country_code VALUES ("Anguilla",'AI');
INSERT INTO country_code VALUES ("Antarctica",'AQ');
INSERT INTO country_code VALUES ("Antigua and Barbuda",'AG');
INSERT INTO country_code VALUES ("Argentina",'AR');
INSERT INTO country_code VALUES ("Armenia",'AM');
INSERT INTO country_code VALUES ("Aruba",'AW');
INSERT INTO country_code VALUES ("Australia",'AU');
INSERT INTO country_code VALUES ("Austria",'AT');
INSERT INTO country_code VALUES ("Azerbaijan",'AZ');
INSERT INTO country_code VALUES ("Bahamas",'BS');
INSERT INTO country_code VALUES ("Bahrain",'BH');
INSERT INTO country_code VALUES ("Bangladesh",'BD');
INSERT INTO country_code VALUES ("Barbados",'BB');
INSERT INTO country_code VALUES ("Belarus",'BY');
INSERT INTO country_code VALUES ("Belgium",'BE');
INSERT INTO country_code VALUES ("Belize",'BZ');
INSERT INTO country_code VALUES ("Benin",'BJ');
INSERT INTO country_code VALUES ("Bermuda",'BM');
INSERT INTO country_code VALUES ("Bhutan",'BT');
INSERT INTO country_code VALUES ("Bolivia",'BO');
INSERT INTO country_code VALUES ("Bonaire, Sint Eustatius and Saba",'BQ');
INSERT INTO country_code VALUES ("Bosnia and Herzegovina",'BA');
INSERT INTO country_code VALUES ("Botswana",'BW');
INSERT INTO country_code VALUES ("Bouvet Island",'BV');
INSERT INTO country_code VALUES ("Brazil",'BR');
INSERT INTO country_code VALUES ("British Indian Ocean Territory",'IO');
INSERT INTO country_code VALUES ("Brunei Darussalam",'BN');
INSERT INTO country_code VALUES ("Bulgaria",'BG');
INSERT INTO country_code VALUES ("Burkina Faso",'BF');
INSERT INTO country_code VALUES ("Burundi",'BI');
INSERT INTO country_code VALUES ("Cambodia",'KH');
INSERT INTO country_code VALUES ("Cameroon",'CM');
INSERT INTO country_code VALUES ("Canada",'CA');
INSERT INTO country_code VALUES ("Cape Verde",'CV');
INSERT INTO country_code VALUES ("Cayman Islands",'KY');
INSERT INTO country_code VALUES ("Central African Republic",'CF');
INSERT INTO country_code VALUES ("Chad",'TD');
INSERT INTO country_code VALUES ("Chile",'CL');
INSERT INTO country_code VALUES ("China",'CN');
INSERT INTO country_code VALUES ("Christmas Island",'CX');
INSERT INTO country_code VALUES ("Cocos (Keeling) Islands",'CC');
INSERT INTO country_code VALUES ("Colombia",'CO');
INSERT INTO country_code VALUES ("Comoros",'KM');
INSERT INTO country_code VALUES ("Congo",'CG');
INSERT INTO country_code VALUES ("Congo, The Democratic Republic of the",'CD');
INSERT INTO country_code VALUES ("Cook Islands",'CK');
INSERT INTO country_code VALUES ("Costa Rica",'CR');
INSERT INTO country_code VALUES ("Côte d'Ivoire",'CI');
INSERT INTO country_code VALUES ("Croatia",'HR');
INSERT INTO country_code VALUES ("Cuba",'CU');
INSERT INTO country_code VALUES ("Curaçao",'CW');
INSERT INTO country_code VALUES ("Cyprus",'CY');
INSERT INTO country_code VALUES ("Czech Republic",'CZ');
INSERT INTO country_code VALUES ("Denmark",'DK');
INSERT INTO country_code VALUES ("Djibouti",'DJ');
INSERT INTO country_code VALUES ("Dominica",'DM');
INSERT INTO country_code VALUES ("Dominican Republic",'DO');
INSERT INTO country_code VALUES ("Ecuador",'EC');
INSERT INTO country_code VALUES ("Egypt",'EG');
INSERT INTO country_code VALUES ("El Salvador",'SV');
INSERT INTO country_code VALUES ("Equatorial Guinea",'GQ');
INSERT INTO country_code VALUES ("Eritrea",'ER');
INSERT INTO country_code VALUES ("Estonia",'EE');
INSERT INTO country_code VALUES ("Ethiopia",'ET');
INSERT INTO country_code VALUES ("Falkland Islands (Malvinas)",'FK');
INSERT INTO country_code VALUES ("Faroe Islands",'FO');
INSERT INTO country_code VALUES ("Fiji",'FJ');
INSERT INTO country_code VALUES ("Finland",'FI');
INSERT INTO country_code VALUES ("France",'FR');
INSERT INTO country_code VALUES ("French Guiana",'GF');
INSERT INTO country_code VALUES ("French Polynesia",'PF');
INSERT INTO country_code VALUES ("French Southern Territories",'TF');
INSERT INTO country_code VALUES ("Gabon",'GA');
INSERT INTO country_code VALUES ("Gambia",'GM');
INSERT INTO country_code VALUES ("Georgia",'GE');
INSERT INTO country_code VALUES ("Germany",'DE');
INSERT INTO country_code VALUES ("Ghana",'GH');
INSERT INTO country_code VALUES ("Gibraltar",'GI');
INSERT INTO country_code VALUES ("Greece",'GR');
INSERT INTO country_code VALUES ("Greenland",'GL');
INSERT INTO country_code VALUES ("Grenada",'GD');
INSERT INTO country_code VALUES ("Guadeloupe",'GP');
INSERT INTO country_code VALUES ("Guam",'GU');
INSERT INTO country_code VALUES ("Guatemala",'GT');
INSERT INTO country_code VALUES ("Guernsey",'GG');
INSERT INTO country_code VALUES ("Guinea",'GN');
INSERT INTO country_code VALUES ("Guinea-Bissau",'GW');
INSERT INTO country_code VALUES ("Guyana",'GY');
INSERT INTO country_code VALUES ("Haiti",'HT');
INSERT INTO country_code VALUES ("Heard Island and McDonald Islands",'HM');
INSERT INTO country_code VALUES ("Holy See (Vatican City State)",'VA');
INSERT INTO country_code VALUES ("Honduras",'HN');
INSERT INTO country_code VALUES ("Hong Kong",'HK');
INSERT INTO country_code VALUES ("Hungary",'HU');
INSERT INTO country_code VALUES ("Iceland",'IS');
INSERT INTO country_code VALUES ("India",'IN');
INSERT INTO country_code VALUES ("Indonesia",'ID');
INSERT INTO country_code VALUES ("Iran, Islamic Republic of",'IR');
INSERT INTO country_code VALUES ("Iraq",'IQ');
INSERT INTO country_code VALUES ("Ireland",'IE');
INSERT INTO country_code VALUES ("Isle of Man",'IM');
INSERT INTO country_code VALUES ("Israel",'IL');
INSERT INTO country_code VALUES ("Italy",'IT');
INSERT INTO country_code VALUES ("Jamaica",'JM');
INSERT INTO country_code VALUES ("Japan",'JP');
INSERT INTO country_code VALUES ("Jersey",'JE');
INSERT INTO country_code VALUES ("Jordan",'JO');
INSERT INTO country_code VALUES ("Kazakhstan",'KZ');
INSERT INTO country_code VALUES ("Kenya",'KE');
INSERT INTO country_code VALUES ("Kiribati",'KI');
INSERT INTO country_code VALUES ("Korea, Democratic People's Republic of",'KP');
INSERT INTO country_code VALUES ("Korea, Republic of",'KR');
INSERT INTO country_code VALUES ("Kuwait",'KW');
INSERT INTO country_code VALUES ("Kyrgyzstan",'KG');
INSERT INTO country_code VALUES ("Lao People's Democratic Republic",'LA');
INSERT INTO country_code VALUES ("Latvia",'LV');
INSERT INTO country_code VALUES ("Lebanon",'LB');
INSERT INTO country_code VALUES ("Lesotho",'LS');
INSERT INTO country_code VALUES ("Liberia",'LR');
INSERT INTO country_code VALUES ("Libya",'LY');
INSERT INTO country_code VALUES ("Liechtenstein",'LI');
INSERT INTO country_code VALUES ("Lithuania",'LT');
INSERT INTO country_code VALUES ("Luxembourg",'LU');
INSERT INTO country_code VALUES ("Macao",'MO');
INSERT INTO country_code VALUES ("Macedonia, Republic of",'MK');
INSERT INTO country_code VALUES ("Madagascar",'MG');
INSERT INTO country_code VALUES ("Malawi",'MW');
INSERT INTO country_code VALUES ("Malaysia",'MY');
INSERT INTO country_code VALUES ("Maldives",'MV');
INSERT INTO country_code VALUES ("Mali",'ML');
INSERT INTO country_code VALUES ("Malta",'MT');
INSERT INTO country_code VALUES ("Marshall Islands",'MH');
INSERT INTO country_code VALUES ("Martinique",'MQ');
INSERT INTO country_code VALUES ("Mauritania",'MR');
INSERT INTO country_code VALUES ("Mauritius",'MU');
INSERT INTO country_code VALUES ("Mayotte",'YT');
INSERT INTO country_code VALUES ("Mexico",'MX');
INSERT INTO country_code VALUES ("Micronesia, Federated States of",'FM');
INSERT INTO country_code VALUES ("Moldova",'MD');
INSERT INTO country_code VALUES ("Monaco",'MC');
INSERT INTO country_code VALUES ("Mongolia",'MN');
INSERT INTO country_code VALUES ("Montenegro",'ME');
INSERT INTO country_code VALUES ("Montserrat",'MS');
INSERT INTO country_code VALUES ("Morocco",'MA');
INSERT INTO country_code VALUES ("Mozambique",'MZ');
INSERT INTO country_code VALUES ("Myanmar",'MM');
INSERT INTO country_code VALUES ("Namibia",'NA');
INSERT INTO country_code VALUES ("Nauru",'NR');
INSERT INTO country_code VALUES ("Nepal",'NP');
INSERT INTO country_code VALUES ("Netherlands",'NL');
INSERT INTO country_code VALUES ("New Caledonia",'NC');
INSERT INTO country_code VALUES ("New Zealand",'NZ');
INSERT INTO country_code VALUES ("Nicaragua",'NI');
INSERT INTO country_code VALUES ("Niger",'NE');
INSERT INTO country_code VALUES ("Nigeria",'NG');
INSERT INTO country_code VALUES ("Niue",'NU');
INSERT INTO country_code VALUES ("Norfolk Island",'NF');
INSERT INTO country_code VALUES ("Northern Mariana Islands",'MP');
INSERT INTO country_code VALUES ("Norway",'NO');
INSERT INTO country_code VALUES ("Oman",'OM');
INSERT INTO country_code VALUES ("Pakistan",'PK');
INSERT INTO country_code VALUES ("Palau",'PW');
INSERT INTO country_code VALUES ("Palestinian Territory, Occupied",'PS');
INSERT INTO country_code VALUES ("Panama",'PA');
INSERT INTO country_code VALUES ("Papua New Guinea",'PG');
INSERT INTO country_code VALUES ("Paraguay",'PY');
INSERT INTO country_code VALUES ("Peru",'PE');
INSERT INTO country_code VALUES ("Philippines",'PH');
INSERT INTO country_code VALUES ("Pitcairn",'PN');
INSERT INTO country_code VALUES ("Poland",'PL');
INSERT INTO country_code VALUES ("Portugal",'PT');
INSERT INTO country_code VALUES ("Puerto Rico",'PR');
INSERT INTO country_code VALUES ("Qatar",'QA');
INSERT INTO country_code VALUES ("Reunion",'RE');
INSERT INTO country_code VALUES ("Romania",'RO');
INSERT INTO country_code VALUES ("Russian Federation",'RU');
INSERT INTO country_code VALUES ("Rwanda",'RW');
INSERT INTO country_code VALUES ("Saint Barthélemy",'BL');
INSERT INTO country_code VALUES ("Saint Helena, Ascension and Tristan da Cunha",'SH');
INSERT INTO country_code VALUES ("Saint Kitts and Nevis",'KN');
INSERT INTO country_code VALUES ("Saint Lucia",'LC');
INSERT INTO country_code VALUES ("Saint Martin (French part)",'MF');
INSERT INTO country_code VALUES ("Saint Pierre and Miquelon",'PM');
INSERT INTO country_code VALUES ("Saint Vincent and the Grenadines",'VC');
INSERT INTO country_code VALUES ("Samoa",'WS');
INSERT INTO country_code VALUES ("San Marino",'SM');
INSERT INTO country_code VALUES ("Sao Tome and Principe",'ST');
INSERT INTO country_code VALUES ("Saudi Arabia",'SA');
INSERT INTO country_code VALUES ("Senegal",'SN');
INSERT INTO country_code VALUES ("Serbia",'RS');
INSERT INTO country_code VALUES ("Seychelles",'SC');
INSERT INTO country_code VALUES ("Sierra Leone",'SL');
INSERT INTO country_code VALUES ("Singapore",'SG');
INSERT INTO country_code VALUES ("Sint Maarten (Dutch part)",'SX');
INSERT INTO country_code VALUES ("Slovakia",'SK');
INSERT INTO country_code VALUES ("Slovenia",'SI');
INSERT INTO country_code VALUES ("Solomon Islands",'SB');
INSERT INTO country_code VALUES ("Somalia",'SO');
INSERT INTO country_code VALUES ("South Africa",'ZA');
INSERT INTO country_code VALUES ("South Georgia and the South Sandwich Islands",'GS');
INSERT INTO country_code VALUES ("Spain",'ES');
INSERT INTO country_code VALUES ("Sri Lanka",'LK');
INSERT INTO country_code VALUES ("Sudan",'SD');
INSERT INTO country_code VALUES ("Suriname",'SR');
INSERT INTO country_code VALUES ("South Sudan",'SS');
INSERT INTO country_code VALUES ("Svalbard and Jan Mayen",'SJ');
INSERT INTO country_code VALUES ("Swaziland",'SZ');
INSERT INTO country_code VALUES ("Sweden",'SE');
INSERT INTO country_code VALUES ("Switzerland",'CH');
INSERT INTO country_code VALUES ("Syrian Arab Republic",'SY');
INSERT INTO country_code VALUES ("Taiwan",'TW');
INSERT INTO country_code VALUES ("Tajikistan",'TJ');
INSERT INTO country_code VALUES ("Tanzania, United Republic of",'TZ');
INSERT INTO country_code VALUES ("Thailand",'TH');
INSERT INTO country_code VALUES ("Timor-Leste",'TL');
INSERT INTO country_code VALUES ("Togo",'TG');
INSERT INTO country_code VALUES ("Tokelau",'TK');
INSERT INTO country_code VALUES ("Tonga",'TO');
INSERT INTO country_code VALUES ("Trinidad and Tobago",'TT');
INSERT INTO country_code VALUES ("Tunisia",'TN');
INSERT INTO country_code VALUES ("Turkey",'TR');
INSERT INTO country_code VALUES ("Turkmenistan",'TM');
INSERT INTO country_code VALUES ("Turks and Caicos Islands",'TC');
INSERT INTO country_code VALUES ("Tuvalu",'TV');
INSERT INTO country_code VALUES ("Uganda",'UG');
INSERT INTO country_code VALUES ("Ukraine",'UA');
INSERT INTO country_code VALUES ("United Arab Emirates",'AE');
INSERT INTO country_code VALUES ("United Kingdom",'GB');
INSERT INTO country_code VALUES ("United States",'US');
INSERT INTO country_code VALUES ("United States Minor Outlying Islands",'UM');
INSERT INTO country_code VALUES ("Uruguay",'UY');
INSERT INTO country_code VALUES ("Uzbekistan",'UZ');
INSERT INTO country_code VALUES ("Vanuatu",'VU');
INSERT INTO country_code VALUES ("Venezuela",'VE');
INSERT INTO country_code VALUES ("Viet Nam",'VN');
INSERT INTO country_code VALUES ("Virgin Islands, British",'VG');
INSERT INTO country_code VALUES ("Virgin Islands, U.S.",'VI');
INSERT INTO country_code VALUES ("Wallis and Futuna",'WF');
INSERT INTO country_code VALUES ("Western Sahara",'EH');
INSERT INTO country_code VALUES ("Yemen",'YE');
INSERT INTO country_code VALUES ("Zambia",'ZM');
INSERT INTO country_code VALUES ("Zimbabwe",'ZW');
