I have a table that looks like this:
+-----------+---------+-----------+------+-----+---------+----------------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-----------+---------+-----------+------+-----+---------+----------------+---------------------------------+---------+
| id | int(11) | NULL | NO | PRI | NULL | auto_increment | select,insert,update,references | |
| l125 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| l250 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| l500 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| l1000 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| l2000 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| l4000 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| l6000 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| l8000 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| r125 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| r250 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| r500 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| r1000 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| r2000 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| r4000 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| r6000 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| r8000 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| accountId | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| l3000 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| r3000 | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
+-----------+---------+-----------+------+-----+---------+----------------+---------------------------------+---------+
I would like to modify the table so that I l125 and l250 are removed and I'd like to add a new row with the name l1500.
You just need ALTER TABLE
(note they are columns, not rows that you are changing):
ALTER TABLE yourtable
DROP COLUMN l125,
DROP COLUMN l250,
ADD COLUMN l1500 INT NULL DEFAULT NULL AFTER l1000
Note I've assumed you want the l1500
column to have the same definition as the other lnnn
columns.