List:General Discussion« Previous MessageNext Message »
From:Jesper Wisborg Krogh Date:April 14 2010 11:49pm
Subject:Re: CLI can't read data from table
View as plain text  
On Thu, 15 Apr 2010 09:31:04 Mike Diehl wrote:
> I just created a new table called "lines."  I can use Open Office to read
> the records in it just fine.
>
> However, when I type this command at the cli, I get an error:
>
>
> select * from lines;
> 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 'lines' at line 1

Lines is a reserved keyword (e.g. like in "LINES TERMINATED BY"), so it must be quoted:

test> use test;
Database changed
test> CREATE TABLE `lines` (id int unsigned NOT NULL PRIMARY KEY) ENGINE=InnoDB;
Query OK, 0 rows affected (0.20 sec)

test> SELECT * FROM lines;
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 'lines' at line
1
test> SELECT * FROM `lines`;
Empty set (0.01 sec)

Best regards,
Jesper
Thread
CLI can't read data from tableMike Diehl15 Apr
  • Re: CLI can't read data from tableJesper Wisborg Krogh15 Apr
    • Re: CLI can't read data from tableMike Diehl15 Apr
      • Re: CLI can't read data from tableDan Nelson15 Apr
        • Re: CLI can't read data from tableMike Diehl15 Apr