adi intern adi intern - 2 months ago 20
MySQL Question

How to change the Uppercase column name to lower case using mysql?




I want to change my column name from upper case to lower case?
I have followed the following query.

alter table machine_status change Time time;

mysql> desc machine_status;


+-----------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------+------+-----+---------+-------+
| Time | int(11) | NO | | NULL | |
| Available | int(11) | YES | | NULL | |
| Closed | int(11) | YES | | NULL | |
| Used | int(11) | YES | | NULL | |
| Busy | int(11) | YES | | NULL | |
| Reserved | int(11) | YES | | NULL | |
| Down | int(11) | YES | | NULL | |

mysql> alter table machine_status change Time time;
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 '' at line 1

Answer

Try this code

mysql> ALTER TABLE `users` CHANGE `groups` `groupid` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;