Insert into table name SELECT statement

Source: Internet
Author: User
Tags dname


Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 Connected as scott SQL code SQL> select * from dept; deptno dname loc ------ ------------ ------------- 10 accounting new york 20 research dallas 30 sales chicago 40 operations boston SQL> create table dept2 as select * from dept; Table created www.2cto.com SQL> select * from dept; deptno dname loc ----------------------------- ---- 10 accounting new york 20 research dallas 30 sales chicago 40 operations boston SQL> select * from dept2; deptno dname loc ------ ------------ ------------- 10 accounting new york 20 research dallas 30 sales chicago 40 operations boston SQL> create table dept3 as select * from dept where 1 = 2; table created www.2cto.com SQL> select * from dept3; DEPTNO DNAME LOC ------------------------- -------- SQL> select OWNER from user_constraints where table_name = 'dept'; OWNER then scott SQL> select OWNER from user_constraints where table_name = 'dept2 '; OWNER -------------------------------------------------------------------------------- the preceding create table name as select statement shows that 1: only copies TABLE data and TABLE structure without any constraints. 2: When the where condition is invalid, only the table structure is copied and no task data is available.
From the Ear's blog

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.