Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: alter table

Re: alter table

From: Jonathan Gennick <gennick_at_worldnet.att.net>
Date: Wed, 17 Jun 1998 00:37:24 GMT
Message-ID: <6m733q$qt@bgtnsc03.worldnet.att.net>


On Tue, 16 Jun 1998 13:38:26 GMT, chris_at_ultramedia.co.uk wrote:

>How do I delete a column from a database?
>
>can I just do something along the lines of:-
>
>ALTER TABLE myTable
>drop myColumn;

No. You have to save the data, drop the table, recreate the table, and reload the data. Along the way you also have to deal with integrity constraints, indexes, etc. It's a bit of a nuisance. What you can do temporarily is simply make the columnn a nullable column. Then everyone can pretend it doesn't exist. If you don't mind the untidyness of having the column sit in the table, you don't ever have to really delete it.

>..also can I use a select statement to get data from one database table
>into another database's table?

Here's one way:

INSERT INTO table_a

        (col_1, col_2, col_3)
SELECT col_a, col_b, col_c

	FROM table_b
	WHERE col_1 = XXX;

You can also do:

	CREATE TABLE table_a AS
		SELECT col_a, col_b, col_c 
		FROM table_b;

regards,

Jonathan Received on Tue Jun 16 1998 - 19:37:24 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US