Gondim
Gondim

Reputation: 3048

MySQL insertion with all values at once

I was doing an INSERT INTO TABLE(...,...,...,...,...) VALUES(...,...,..., When I closed by mistake my MySQL Query Browser. The table has too many columns, so I was wondering, is there a command that you don't need to type all names of the columns table?

If so, how?

Upvotes: 0

Views: 84

Answers (2)

Mchl
Mchl

Reputation: 62395

THere is

INSERT INTO TABLE VALUES(...,...,...)

You just need to specify ALL fields in EXACTLY same sequence as they're in table definition.

For AUTO_INCREMENT column, or for columns where you want to use DEFAULT value as defined in table definition (also TIMESTAMPs) use null as a value.

Upvotes: 4

Klaus Byskov Pedersen
Klaus Byskov Pedersen

Reputation: 121067

If you are insterting into all the columns you can write:

 insert into tablename values(...,...,etc.)

Upvotes: 1

Related Questions