I have a basic customer table. The columns are:
FirstName LastName Organization PhoneNumber City State Zip ID
ID
is an autoincremented value.
I want to insert a new record into the table so I issue this command:
INSERT INTO CustomerTable (FirstName, LastName, Organization, PhoneNumber, City, State, Zip) VALUES (John, Doe, None, 5555555555, Nowhere, NY, 12345);
However, when I issue this statement, I get this error:
ERROR 1054 (42s22): Unknown column 'John' in 'field list'
Why am I getting this error? 'John' is a value to go in a column, not an actual column itself.
Thanks in advance for any help!
Put the string values in quotes. Outside quotes those strings will be treated as column or variable names.
VALUES (John, Doe, None, 5555555555, Nowhere, NY, 12345)
Should be
VALUES ('John', 'Doe', 'None', 5555555555, 'Nowhere', 'NY', 12345)