On Wed, Jul 18, 2001 at 06:06:51PM +0800, Orlando Andico wrote:
> On Wed, 18 Jul 2001, Percy wrote:
> ..
> > hello all!
> >
> > how to drop columns in postgresql?
> 
> according to pg expert Mike, hindi pwede. Alam ko hindi rin pwede sa
> Oracle. The way to do it is
> 
> CREATE TABLE new_table AS SELECT list_of_columns FROM old_table;
> DROP TABLE old_table;
> CREATE VIEW old_table AS SELECT * from new_table;
> 
> although pg allows table renaming so you prolly don't need the CREATE
> VIEW. oracle needs it though.

In PostgreSQL,

CREATE TABLE new_table AS SELECT list_of_columns FROM old_table;
DROP TABLE old_table;
ALTER TABLE new_table RENAME TO old_table;


-- 
___ eric pareja ([EMAIL PROTECTED]) - "We're all crazy. No one wants to admit it."
\@/ http://gra.ph/~xenos/xenos.pgp | http://plug.linux.org.ph [O(///)O]======+
 v  "Even the smallest person can change the course of the future."   / Clue |
    [ Chiba City: A Cyberpunk MUSH | http://chibacity.erisian.net ]  +-------+

_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

To subscribe to the Linux Newbies' List: send "subscribe" in the body to 
[EMAIL PROTECTED]

Reply via email to