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?
开发者_JS百科If so, how?
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 TIMESTAMP
s) use null
as a value.
If you are insterting into all the columns you can write:
insert into tablename values(...,...,etc.)
精彩评论