Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
Other Resources:
How To Create a New Table by Selecting Rows from Another Table
How To Create a New Table by Selecting Rows from Another Table? - Oracle DBA FAQ - Understanding SQL DDL Statements
✍: FYIcenter.com
Let's say you have a table with many data rows, now you want to create a backup copy of this table of all rows or a subset of them, you can use the CREATE TABLE...AS SELECT statement to do this. Here is an example script:
>.\bin\sqlplus /nolog SQL> connect HR/fyicenter Connected. SQL> CREATE TABLE emp_dept_10 2 AS SELECT * FROM employees WHERE department_id=10; Table created. SQL> SELECT first_name, last_name, salary 2 FROM emp_dept_10; FIRST_NAME LAST_NAME SALARY -------------------- ------------------------- ---------- Jennifer Whalen 4400
As you can see, this SQL scripts created a table called "emp_dept_10" using the same column definitions as the "employees" table and copied data rows of one department.
This is really a quick and easy way to create a table.
2007-04-22, 4691👍, 0💬
Popular Posts:
How Are Vertical Margins between Two Block Elements Collapsed? - CSS Tutorials - Understanding Multi...
What will be printed as the resultof the operation below: int x; int modifyvalue() { return(x+=10); ...
What is CodeDom? “CodeDom” is an object model which represents actually a source code. It is designe...
Describe in detail Basic of SAO architecture of Remoting? For these types of questions interviewer e...
How can you write a loop indefinitely? Two examples are listed in the following code: for(;;) { ... ...