Thursday, January 30, 2014

How to create another table with records that satisy your conditions from original table ?

Original Table:Employees







How to create another table which contains employee id greater than 105.
Following is the syntax.

create table tempemp
as select * from employees where employee_id > 105;


Now select table tempemp.It contains only employees having employee_id > 105;

Let us select records table from tempemp and check the results.
You can see new table contains employees > 106.

select * from tempemp;