MySQL server syntax error

1149700 pts.
Tags:
MySQL
I have this SQL query below:
INSERT INTO user_details (username, location, key)
VALUES ('Tim', 'Florida', 42)
But it keeps saying I have a Syntax error - it relates to the MySQL server version for the right syntax. What should I do?
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • AjitK29
    Try This
    INSERT INTO user_details (username, location, key)
    VALUES ('Tim', 'Florida', '42')
    To know more
    http://dev.mysql.com/doc/refman/5.6/en/insert.html
    2,545 pointsBadges:
    report
  • TheRealRaven
    key (as well as keys) is a MySQL reserved word. You might use it as a column name if you ensure that it is always given as a quoted name, e.g., as "key". Try this:
    INSERT INTO user_details (username, location, "key")
    VALUES ('Tim', 'Florida', 42)
    It would be better to recreate the table and use valid names.

    If you still get a syntax error, be sure to post an exact copy of the statement and exact, complete copies of all messages shown.
    36,035 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: