0

When I inserted this data to my database's table, I got below error which is not easy for me to solve.

INSERT INTO 'student' ('id', 'name', 'roll', 'address') 
VALUES (NULL, 'Rahul', '101', 'Ranchi'), (NULL, 'Rohit', '102', 'Delhi')

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''student' ('id', 'name', 'roll', 'address') VALUES (NULL, 'Rahul', '101', 'Ranch' at line 1

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • 2
    Can you post the Table structure? – Jeba Jan 07 '20 at 06:27
  • 1
    Does this answer your question? [When to use single quotes, double quotes, and backticks in MySQL](https://stackoverflow.com/questions/11321491/when-to-use-single-quotes-double-quotes-and-backticks-in-mysql) – Dharman Jan 07 '20 at 07:33
  • Please post the table structure. Otherwise, we cannot assume the answer to your question. Anyway please refer [MySQL Error 1064](https://www.inmotionhosting.com/support/website/databases/error-1064) – shalitha senanayaka Jan 07 '20 at 07:41

1 Answers1

0

Remove '' from table column names as well as table name and you are good to go. Try this:

INSERT INTO student (id, name, roll, address)
VALUES
  (NULL, 'Rahul', '101', 'Ranchi'),(NULL, 'Rohit', '102', 'Delhi');

Also, there are various websites such as W3schools to check the sql command syntax, kindly use them for such errors.

tech_enthusiast
  • 683
  • 3
  • 12
  • 37