Re: [SQL] Stupid SQl question on inserting items - Mailing list pgsql-sql

From D'Arcy" "J.M." Cain
Subject Re: [SQL] Stupid SQl question on inserting items
Date
Msg-id m10mMux-0000bIC@druid.net
Whole thread Raw
In response to Stupid SQl question on inserting items  ("Zot O'Connor" <zot@ZotConsulting.com>)
List pgsql-sql
Thus spake Zot O'Connor
> This is a dumb basic level SQL question.
> 
> is there any other way to insert records without having to fill in all
> of the values as in
> 
> INSERT into table_name WITH VALUES (blah, blah, blah...)

Yes.  Specify the fields in the insert.

INSERT INTO table_name (field1, field2, field4) VALUES (val1, val2, val4);

This is a good idea in any case even when inserting to all fields in case
something changes in the database schema.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.


pgsql-sql by date:

Previous
From: "Steven M. Wheeler"
Date:
Subject: Re: [SQL] Fatal process interaction
Next
From: JT Kirkpatrick
Date:
Subject: using like