Create Table From Another Table

DESCRIBE:-  To display the table structure.

Create A table from another table
Syntax:-1 create table tablename as select query
              2 create table tablename [(col-name,---)] as select query
Ex:-        1) create table employ as select * from vision;
                        Select * from employ;
               2) create table employ1 (empno,name,salary) as select * from vision;
                        Select * from employ1;
    3) create table employ2 as select eno,sal from vision;
            select * from employ2;
     4) create table employ3 as select * from vision where sal>2000
      Select * from employ3 ;
5) create table employ4 as select * from vision where sal<0;
                   Select * from employ4;
Note: In the 5 th example it will create the table with columns(structure) it will not copy any row from the table. Because the condion is false.

 

For
Online Classes

Contact Us: +919885348743