public inbox for [email protected]  
help / color / mirror / Atom feed
From: Adrian Klaver <[email protected]>
To: Rich Shepard <[email protected]>
To: [email protected]
Subject: Re: Definging columns for INSERT statements
Date: Wed, 12 Jun 2024 16:38:54 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>

On 6/12/24 16:24, Rich Shepard wrote:
> On Wed, 12 Jun 2024, Adrian Klaver wrote:
> 
>> Assuming 'people_person_nbr_seq' is the sequence attached to person_nbr
>> and the other DEFAULTs are the column defaults then the syntax would be:
>>
>> INSERT INTO people
>> (person_nbr, lname, fname, job_title, company_nbr,loc_nbr, 
>> direct_phone, cell_phone,email, active)
>> VALUES
>> (DEFAULT, 'klaver', 'adrian', DEFAULT, 1, 1, '555-1234', '555-4321', 
>> '[email protected]', DEFAULT);
>>
>> If they are not the column defaults then just supply the literal value.
> 
> Adrian,
> 
> No matter how many postgres docs and web pages I read I didn't find an
> example as explicit as yours. Columns other than the person_nbr were not
> defined with defaults and I expected to enter them for each row.

The 'Examples' section at the bottom of this page:

https://www.postgresql.org/docs/current/sql-insert.html

is a useful resource.

> 
> Many thanks for another valuable lesson.
> 
> Best regards,
> 
> Rich
> 
> 

-- 
Adrian Klaver
[email protected]







view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Definging columns for INSERT statements
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox