473,320 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

MySQL KeyWords WorkAround

Hi,
I am having a problem with a few "key words" on mysql.
LEFT,DATABASE,FIELDS,LOAD,SEPARATOR ,SQL,KEY

These are currently column names in our application tables.
On other systems (oracle,sql server ect I can get around the problem
by puting quotes around the identifiers. According to the mysql help
this should be possible too. So I tried:

mysql> CREATE TABLE TEST ('LEFT' INT);
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 ''LEF
T' INT)' at line 1
It seems this type of quotes " does not work nor does '.

So the question is how do I get around this problem.

BR
Tim
Jul 20 '05 #1
2 2041
TimMcConechy wrote:
mysql> CREATE TABLE TEST ('LEFT' INT);


It is not ' you should use, but a ` (They don't even look the same, do
they? ;)

# Like this:
CREATE TABLE TEST33 (`LEFT` INT);

If you don't know where to print that character, just copy-paste it from
this message.
Jul 20 '05 #2
TimMcConechy wrote:
Hi,
I am having a problem with a few "key words" on mysql.
LEFT,DATABASE,FIELDS,LOAD,SEPARATOR ,SQL,KEY

These are currently column names in our application tables.
On other systems (oracle,sql server ect I can get around the problem
by puting quotes around the identifiers. According to the mysql help
this should be possible too. So I tried:

mysql> CREATE TABLE TEST ('LEFT' INT);
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 ''LEF
T' INT)' at line 1
It seems this type of quotes " does not work nor does '.

So the question is how do I get around this problem.


Use backticks `
CREATE TABLE TEST (`LEFT` INT);

Remember to always use them in your queries as well eg
SELECT `LEFT` FROM TEST

You really shouldn't use reserved words for column names if you can help it
though.

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dpg | last post by:
How do site searches work? I want to create a MySQL database with a field called "keywords". Then a form with a search phrase input box. I can't figure how to get the results with multiple...
4
by: Hal Halloway | last post by:
can mysql work in Windows but not Solaris? Is there any reason you can see why the fulltext php/mysql code below works OK on my win2k php4.3.6. mysql 4.1.3 pc but does *not* work when put on a...
16
by: Skip Montanaro | last post by:
I'm struggling to get a handle on a slow query problem. I'm running 3.23.41. Here's an entry from the slow log file. # Time: 031006 15:15:43 # User@Host: concerts @ localhost # Time: 173 ...
6
by: frank78 | last post by:
Hi everyone, I am having a little bit of trouble backing up some mySQL tables. I've been trying to adapt a script I found on the internet at...
5
by: Sport Girl | last post by:
Hi again my great online assistants, just would like to say that i'm testing the script under unix , and after researches on the internet, i have realised that to resolve 500 Internal Server Error,...
1
Ajm113
by: Ajm113 | last post by:
Hello everyone. Ok this is my goal: When a user sorts by number of keywords and lets say one result had 5 keywords of what the user entered in that has a better chance on being up top. I already...
1
by: SamudraSri | last post by:
hi everybody i am working wamp since 4+ years. i have a requirement where in i need to search for the record that matches some keywords using fulltext search. tables: ...
1
by: bearophileHUGS | last post by:
Once in a while I feel free to write about less defined things, saying mostly wrong things. This post is mostly chat, if you aren't interested please ignore it. Python is fit enough for newbie...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.