I noticed that when I have a column with auto_increment
, I have to declare the columns in INSERT
.
For example, I created this test table:
create table teste(
id int auto_increment,
nome varchar(100) not null,
valor decimal(5,2),
constraint id_pk primary key (id));
I wanted to be able to insert the data without declaring the columns, as in this example:
insert into teste values ('Danilo',333.33)
But he does not understand, and in the end I have to state it like this:
insert into teste (nome,valor) values ('Danilo',333.33)
My question is if I have to INSERT
without declaring all the columns, type using a reserved word or something of the type that MySQL understands.