FShiwani
FShiwani

Reputation: 181

mySQL Uppercase Table Name

I have a database with tables already in the database. There is a table called Character that I am trying to access to add an additional column. However any command that I use with the table Character gives me the following error:

mysql> SHOW FIELDS FROM Character;
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 'Character' at line 1

I've tried the following commands:

mysql> SHOW FIELDS FROM "Character";
mysql> SHOW FIELDS FROM 'Character';
mysql> SHOW FIELDS FROM Character;

All three give me the same error. I have already selected the appropriate database that contains the Character table using the command "USE dbname;"

Upvotes: 0

Views: 704

Answers (1)

Jorge Campos
Jorge Campos

Reputation: 23381

Character is a reserved word therefore you should use backticks:

SHOW FIELDS FROM `Character`;

See it here 9.3 Keywords and Reserved Words

Also, about the "Uppercase" (or not), read this answer Are table names in MySQL case sensitive?

On this image I'm using MySql Workbench

enter image description here

Upvotes: 4

Related Questions