How do I add a column to an existing table.

From: John Draper <crunch(at)webcrunchers(dot)com>
To: pgsql-general(at)hub(dot)org
Subject: How do I add a column to an existing table.
Date: 2000-09-17 19:55:04
Message-ID: v03110744b5ead0a07a0f@[24.12.41.181]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have this table I call "new_users". The existing first col of that
table is "first_name". I want to add an additional column in FRONT of
the existing first column of "first_name"...

Existing colums... first_name | last_name | <etc>

I want to add... key | first_name | last_name | <etc>

How is that done, then I want to automatically insert into "key" a
sequence of numbers like 1,2,3,4,5,6,7, etc so that each number is
sequentially numbered.

I'm very new to SQL so I suppose this is prolly a pretty dumb question.
The docs on ALTER show how to add a column, but NOT how to add the column
to the beginning, or after adding a column, to re-arrange them so that
the KEY column is first. Could someone please help me?

I have another related question. I know it is possible to "Join" tables,
creating a 3rd table. But can I take this 3rd table and add this table
to my list of tables in my database? If so, now do I do that?

John

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alfred Perlstein 2000-09-17 20:19:56 Re: How do I add a column to an existing table.
Previous Message Stephan Szabo 2000-09-17 19:51:01 Re: Regression test failures