MySQL Forums
Forum List  »  Newbie

alter table move column syntax error
Posted by: Timothy Dunphy
Date: June 28, 2014 01:10PM

Hello,

I'm trying to move a column from one position to another in a table using a positional statement (sixth).

Here is how my table is laid out:

mysql> desc car_table;
+--------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+--------------+------+-----+---------+----------------+
| car_id | int(11) | NO | PRI | NULL | auto_increment |
| vin | varchar(17) | YES | | NULL | |
| make | varchar(10) | YES | | NULL | |
| model | varchar(20) | YES | | NULL | |
| year | decimal(4,0) | YES | | NULL | |
| color | varchar(10) | YES | | NULL | |
| price | decimal(7,2) | YES | | NULL | |
+--------+--------------+------+-----+---------+----------------+
7 rows in set (0.05 sec)

And this is the statement that is erroring out:

mysql> alter table car_table modify column year sixth;

And this is the actual error I'm getting:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sixth' at line 1

Can someone please help me out with the syntax I'm trying to use? I'd like to understand what I'm doing wrong here.

Thank you

Options: ReplyQuote


Subject
Written By
Posted
alter table move column syntax error
June 28, 2014 01:10PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.