| vineet |
Posted: Jul 26, 2007 06:25:59 AM |
Total Post: 23
Joined: Feb, 2006
|
hi everybody.
i have a table user1(user_id,pass).
now i want to create a table user2 as:
create table user2(u_id,p_wd) as select * from user1.
can i do so.
thanks |
|
|
Nehru |
| Posted: Jul 26, 2007 07:07:01 AM | |
|
Total Post: 46
Joined: Jul, 2007
|
Hi Vineet,
You can create a table similar to existing table with the following statemet
" CREATE TABLE EMP1 AS SELECT * FROM EMP WHERE 1=2 "
This give you the Structure of the existing table not the data
If you want data also then go for this
"CREATE TABLE EMP1 AS SELECT * FROM EMP "
If table already exist then you want only inserting the data from the existing table then go for this:
"INSERT INTO EMP1 SELECT *FROM EMP;"
Take Care
Bye
Kiran
|
|
|
|
|
Ramesh Joyisa |
| Posted: Aug 07, 2007 05:22:57 AM | |
|
Total Post: 246
Joined: Aug, 2007
|
Dear Vineet,
It is possible to create table with the script
create table user2(u_id,p_wd) as select * from user1.
You can create tables with the different column names but the data type must be same so you cannot mension the data types in the script
|
|
|
|
|
RAJNISH |
| Posted: Sep 04, 2007 06:51:49 AM | |
|
Total Post: 92
Joined: Jan, 2007
|
yes you can create table2 but when you creating like this
crea tebale tab2 as select * from tab1 your tab2 table beccome constraints free it means whatever constraints are defined with your tab1 whereas tab2 become without constraints.
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |