Linux Tips and Tricks

Saturday, May 13, 2006

querying a mysql table that has a '-' in its name

simply querying the table like:

mysql>SELECT * FROM people-table;

will produce:

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

The answer is, we must enclose the table name with the tick ` symbol.

mysql> SELECT * FROM `people-table`;

will give the desired results.

0 Comments:

Post a Comment

<< Home