Friday, April 9, 2010

WHERE Clause

0 comments
The WHERE clause specifies the search condition for selecting rows in the virtual table defined by the FROM clause. The matching rows constitute the resulting rowset. The WHERE clause is an optional part of the SELECT statement. However, if the WHERE clause is absent, the resulting rowset can be extremely large because all rows of the virtual table defined by the FROM clause are returned in the resulting rowset.

Select e_name
from employee
where dept_id=10;



Extract all those employees that have 'ali' as their names and are working in dept 10
Select *
from employee
where e_name='ali'
and dept=10;
Select all invoices for the entire month of April of 2010
Select *
from invoice
where invoid_date between'2010-04-01 00:00:00' and '2010-04-31 23:59:59'








0 comments: