Re: CLI can't read data from table
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
Re: CLI can't read data from table
On Wednesday 14 April 2010 5:49:43 pm Jesper Wisborg Krogh wrote: > 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) Yup, that was it. I'm migrating from Postgres, so it never occured to me that "lines" might be reserved. Thanks. -- Take care and have fun, Mike Diehl. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: CLI can't read data from table
In the last episode (Apr 14), Mike Diehl said: > On Wednesday 14 April 2010 5:49:43 pm Jesper Wisborg Krogh wrote: > > 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) > > Yup, that was it. I'm migrating from Postgres, so it never occured to me > that "lines" might be reserved. On the plus side, you can now use the word "vacuum" :) -- Dan Nelson dnel...@allantgroup.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: CLI can't read data from table
On Wednesday 14 April 2010 7:39:03 pm Dan Nelson wrote: > In the last episode (Apr 14), Mike Diehl said: > > On Wednesday 14 April 2010 5:49:43 pm Jesper Wisborg Krogh wrote: > > > 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) > > > > Yup, that was it. I'm migrating from Postgres, so it never occured to me > > that "lines" might be reserved. > > On the plus side, you can now use the word "vacuum" :) I needed a good chuckle. Thank you! -- Take care and have fun, Mike Diehl. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org