MySQL and ALTER TABLE, How?
Posted: Wed Oct 02, 2002 8:57 am
Newbe, I have just got MySQL started and entered my first table from a book I am reading to learh php and MySQL but I passed over one of the table entries, this is how my table looks using DESCRIBE tablename:
Thanks
Mike
and this is how it should look:+---------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+----------------+
| name | varchar(20) | YES | | NULL | |
| address | varchar(30) | YES | | NULL | |
| town | varchar(20) | YES | | NULL | |
| ID | int(11) | | PRI | NULL | auto_increment |
+---------+-------------+------+-----+---------+----------------+
so as you can see I missed out an entry of "country VARCHAR(20)," after town, I looked up a way of changing this or altering the table on the internet and found this:+---------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+----------------+
| name | varchar(20) | YES | | NULL | |
| address | varchar(30) | YES | | NULL | |
| town | varchar(20) | YES | | NULL | |
| country | varchar(20) | YES | | NULL | |
| ID | int(11) | | PRI | NULL | auto_increment |
+---------+-------------+------+-----+---------+----------------+
could someone please explain, do I type something in place of aleration and alteration ...? this is not covered in the book I am using."ALTER TABLE tablename alteration [, alteration ...]" and
"ADD [COLUMN[ column_description
[FIRST | AFTER column ]"
Thanks
Mike