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 ('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 ('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 ('COTE D\'IVOIRE','CI');
INSERT INTO country_code VALUES ('CROATIA','HR');
INSERT INTO country_code VALUES ('CUBA','CU');
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 ('EAST TIMOR','TP');
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 ('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 ('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 ('JORDAN','JO');
INSERT INTO country_code VALUES ('KAZAKSTAN','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 ('LIBYAN ARAB JAMAHIRIYA','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 ('MACAU','MO');
INSERT INTO country_code VALUES ('MACEDONIA, THE FORMER YUGOSLAV 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, REPUBLIC OF','MD');
INSERT INTO country_code VALUES ('MONACO','MC');
INSERT INTO country_code VALUES ('MONGOLIA','MN');
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 ('NETHERLANDS ANTILLES','AN');
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 HELENA','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 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 ('SEYCHELLES','SC');
INSERT INTO country_code VALUES ('SIERRA LEONE','SL');
INSERT INTO country_code VALUES ('SINGAPORE','SG');
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 ('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, PROVINCE OF CHINA','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 ('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 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 ('YUGOSLAVIA','YU');
INSERT INTO country_code VALUES ('ZAMBIA','ZM');
INSERT INTO country_code VALUES ('ZIMBABWE','ZW');
INSERT INTO country_code VALUES ('UNITED KINGDOM','UK');
