Reputation: 5326
I wrote this simple query statement:
INSERT INTO merchants
('firstName','lastName')
VALUES
('Bob','Smith')
Sounds very simple but I keep getting this error:
`#1064 - 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 ''firstName','lastName' ) VALUES ('Bob','Smith' )' at line 2
Upvotes: 1
Views: 249
Reputation: 354969
You need to remove the quotes from around firstName and lastName:
INSERT INTO merchants
(firstName,lastName)
VALUES
('Bob','Smith')
Column names are identifiers, and as such are not quoted.
Edit: Column names can be quoted using backticks (`), but this is only necessary if you have column names that contain special characters or column names that match MySQL keywords.
Upvotes: 5