4

I have a table which name is data with column name First Name

I am trying to insert data in table but unable to do it as column name is with blank space.

INSERT INTO data(First Name) VALUES('Sample');

How can i do it, please explain.

3
  • enclose your column name with backtick (`) Commented Oct 25, 2016 at 6:23
  • update your query to INSERT INTO data(First Name) VALUES('Sample'); Commented Oct 25, 2016 at 6:24
  • Query should be like this: INSERT INTO data (FirstName) VALUES ('Sample'); Commented Oct 25, 2016 at 6:26

2 Answers 2

5

You need to use backticks to encapsulate the field names

INSERT INTO data(`First Name`) VALUES('Sample');
Sign up to request clarification or add additional context in comments.

Comments

2

Remove space from you column name First Name should be FirstName.

INSERT INTO data(FirstName) VALUES('Sample');

Or your column contain space then you can use like

INSERT INTO data([First Name]) VALUES('Sample');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.