Where Clause :
Where clause is used to filter the rows based on the search condition .
with where clause
*
We can retrieve or modify some specific records in the table
*
We can delete some specific records in the table
*
We cannot insert the records into the table but we can copy the data from one table to another table
Syntax: Where < Search Condition >
The search condition can be any of the following conditions .
* Where with AND condition
* Where with OR condition
* Where with combining AND & OR conditions etc
Examples :
Write a
query to create a table from an existing table
Syntax
Select * into <NewTableName> from <OldTableName>
Ex:
Select * into new_emp from emp
In the above case it creates a table new_emp by copying
all the rows and columns of the emp table
Create a
table from old table without any data in it
Syntax:
Select * into <NTN> from
<old-tablename> where <false-condition>
Ex:
Select * into dummy_emp from emp where 1=2
Create a
table from old table only with specified columns
Select empno,ename
into test_emp from emp
Write a query to copy
the data from one table to another table
Syntax :
Insert
into <NTN> select * from <OTN> where <Condition>
Ex:
Insert into dummy_emp select * from emp where deptno=10
Write a query create
a table with only information of sales department from emp table
Select * into sales_emp from emp where deptno=(select
deptno from dept where dname='sales')