Skip site navigation (1) Skip section navigation (2)

How to add a new field/column in a table

From: Rex Hu <hu(dot)280(at)buckeyemail(dot)osu(dot)edu>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: How to add a new field/column in a table
Date: 2011-03-17 04:01:08
Message-ID: FBC1E85D-630C-4C2E-9787-977748D4E730@buckeyemail.osu.edu (view raw or flat)
Thread:
Lists: pgsql-novice
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.

Thank you!


Hu, Zhengyu (Rex)
Department of Statistics
The Ohio State University
Columbus, OH 43210


Responses

pgsql-novice by date

Next:From: Sean DavisDate: 2011-03-17 04:19:37
Subject: Re: How to add a new field/column in a table
Previous:From: Vibhor KumarDate: 2011-03-16 22:03:10
Subject: Re: postgres 9.0.3 unable to connect using DBD::Pg 2.17.2

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group