How to copy a table in another table with datas?
Answers were Sorted based on User's Feedback
Answer / guest
If new table is not yet created,
create table new_table as select * from old_table;
if new table is already created,
insert into new table select * from old_table
provided the structure of the new table is same as old
table.
Is This Answer Correct ? | 21 Yes | 1 No |
Answer / guest
If new table is not yet created,
create table new_table as select * from old_table;
if new table is already created,
insert into new table select * from old_table
provided the structure of the new table is same as old
table.
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / kavitha nedigunta
create table new_table as select * from old_table;
EG:- create table emp1 as select * from emp;
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / meher
copy from user_name/password@schema_name insert
target_table_name using select * from source_table_name;
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / monty
if you have a table employee you can create duplicate
record using into statement
select *into backup_employee from employee
the above statement create new table backup_employee with
same data of employee
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / mohan
create table emp_dup as select * from emp:
if we have already structure means:
Insert into emp_dup(select * from emp);
Is This Answer Correct ? | 2 Yes | 0 No |
In Oracle 10g :
---------------
Create New Table in another table with same data's:
---------------------------------------------------
copy from coeot1a2/coeot1a2@coeau to scott/tiger@coeau
CREATE s11 using select * from major_list;
Insert data's into another table with same data's:
---------------------------------------------------
copy from coeot1a2/coeot1a2@coeau to scott/tiger@coeau
INSERT s11 using select * from major_list;
Append data's into another table with same data's:
---------------------------------------------------
copy from coeot1a2/coeot1a2@coeau to scott/tiger@coeau
APPEND s11 using select * from major_list;
Replace data's into another table with same data's:
---------------------------------------------------
copy from coeot1a2/coeot1a2@coeau to scott/tiger@coeau
REPLACE s11 using select * from major_list;
Is This Answer Correct ? | 0 Yes | 0 No |
---With date from existing table to new table.
SQL> create table new_table_name as select * from old_table_name where 1=1;
---without data
SQL> create table new_table_name as select * from old_table_name where 1=2;
Thanks,
Is This Answer Correct ? | 0 Yes | 0 No |
Which are the most commonly used sql joins?
Define the select into statement.
What is the difference between sql and t sql?
what is SCALAR Queries?
What is the difference between SQL and PLSQL
what is self join and how it works??
What has stored procedures in sql?
What is a pdo connection?
SELECT emp_num, years, SUM(salary) FROM sales UNION ALL SELECT emp_id, SUM(takehomepay) FROM marketing What error is present in the sample code above? 1. Queries being combined with the UNION ALL statement are not allowed to have SELECT lists with a different number of expressions. 2. You are not allowed to use aggregate functions within two queries joined by a UNION ALL statement. 3. The UNION ALL statement incorrectly combines the "years" result from the first query with the "SUM (takehomepay)" result from the second query. 4. Unless the UNION ALL statement is replaced with a UNION statement, the queries will return duplicates. 5. The "emp_id" column from the second query must be renamed (or aliased) as "emp_num" so that it corresponds to the column name from the first query. Otherwise, the queries will not execute.
What is the basic structure of PL/SQL ?
What are two statement types in sql?
Can we commit in trigger?