Stagg Stagg - 29 days ago 21
SQL Question

Mysql INSERT INTO error #1064

I'm getting this erro : #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 'INSERT INTO Especimes (nome_individual, data_de_nascimento) VALUES ('Amalia', '1' at line 7

while trying to run this:

INSERT INTO Especimes (nome_individual, data_de_nascimento) VALUES ('Amalia', '15/05/1998');


Here is my table:

CREATE TABLE Especimes (
nome_individual VARCHAR(64),
data_de_nascimento VARCHAR(64),
PRIMARY KEY(nome_individual)
)

Answer

the query you provided is right .... have you a sequence of sql command? .. check if before of this query you have missed the ; for the previous command eg:

  CREATE TABLE Especimes (
  nome_individual VARCHAR(64),
  data_de_nascimento VARCHAR(64),
  PRIMARY KEY(nome_individual)
  )
  ;   /* add this */



INSERT INTO Especimes (nome_individual, data_de_nascimento) VALUES ('Amalia', '15/05/1998');

NB the use of proper data is better . (date ) instead of varchar .. but is not the origin of your error

Comments