Home > Mobile >  Error: near "VALUES": syntax error in SQL
Error: near "VALUES": syntax error in SQL

Time:06-09

I am trying to insert these data to the Student table but I get this error

Error: near "VALUES": syntax error

My code:

INSERT INTO Student(Name, Id, Address, TP, BDay)
VALUES ('Amal', 001, 'Kandy', 071, '1000-01-01 00:00:00'),
VALUES ('Kamal', 002, 'Matara', 072, '1000-01-01 00:00:00'),
VALUES ('Nimal', 003, 'Jaffna', 073, '1000-01-01 00:00:00');

This is the table that I created

enter image description here

CodePudding user response:

You do not need to add the word "Values" more.. "," is enough between rows you want to insert:

INSERT INTO Student(Name, Id, Address, TP, BDay)
VALUES ('Amal', 001, 'Kandy', 071, '1000-01-01 00:00:00'),
('Kamal', 002, 'Matara', 072, '1000-01-01 00:00:00'),
('Nimal', 003, 'Jaffna', 073, '1000-01-01 00:00:00');

(This syntax is not valid for Oracle DB's)

  • Related