1
I created a table in Mysql Workbench with the following settings:
CREATE TABLE teste (
id INT AUTO_INCREMENT,
nome VARCHAR(50) NOT NULL,
email VARCHAR(40) NOT NULL
);
And when I try to insert data into the table using:
INSERT INTO teste VALUES
('Meu nome', '[email protected]');
Gives error because I do not put the id, because I believed it was not necessary since the id is AUTO_INCREMENT. I tried to put the first INSERT INTO with the id and the others without the id, but it gives the same error. In this case, I am doing something wrong or every time I insert data into the table through INSERT INTO I have to insert the id too?
A hint, put tbm to the query of
INSERT
– Max Rogério
If you omit column names in Insert yes you should pass a value to the id column
– rray