where clause - SQL ........

“Where” Clause:
 

    This is used to refine result set (output).

Syntax:-

1) select * from <table_name> where <condition>;

    Here condition contains operators, which will be discussed later.

 

     Ex.1) :-  select * from employee_table where emp_id=249;

          2) :-  select * from employee_table where emp_name=’sridhar anumula’;

                 Observe the above two examples, both are contain where clause following a condition.     

In example1, condition is based on Numeric value column and  In example2, condition is based on text  value column. So in example 2 the passing value is enclosed in single quotes(‘ ‘) where in example 1 the passing value is not enclosed in quotes.

Note:- Some versions of SQL accepting double quotes instead of single quotes for text value parameters.

2) select <column1_name>,<column2_name>,…..,<column_name>  from <table_name>

                  where   <condition>;

Ex1:-  select emp_name, emp_Add, emp_phone from employee_table where emp_id=249;

Ex2:-  select emp_name, emp_Add, emp_phone from employee_table

                where emp_name=’sridhar anumula’;