Re: How to add a new field/column in a table

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Rex Hu <hu(dot)280(at)buckeyemail(dot)osu(dot)edu>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: How to add a new field/column in a table
Date: 2011-03-17 04:19:37
Message-ID: AANLkTinKP+Gpffar+uWiKbfWV+T0qz09_9cRRQ48mLDd@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Thu, Mar 17, 2011 at 12:01 AM, Rex Hu <hu(dot)280(at)buckeyemail(dot)osu(dot)edu> wrote:

> Dear all:
>
> Here is what I am trying to do. Suppose that I have a table called
> 'table_1' as follows
>
> id_no | FirstName
> ------------------------
> 1111 | John
> 2222 | Joe
> 3333 | Susan
> 4444 | Eli
>
> Now a want to insert a new field to this table, called 'LastName'. I
> could use the 'ALTER TABLE' statement to add it to the field. However,
> that column only has 'NULL'. Then how do I populate this column with
> the data that I have.
>
>
You are most of the way there. After adding the column, you will want to do
a set of SQL updates to fill in the data.

Sean

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message siva kiran balijepalli 2011-03-17 05:05:34 FETCH in postgresql 8.4
Previous Message Rex Hu 2011-03-17 04:01:08 How to add a new field/column in a table