Where Clause


Prev Tutorial Next Tutorial

Where Clause

Where Clause is used to extract only those records that satisfied the given condition, like fetch only those employee record which have more than 30000 salary.

When use where clause ?

  • To retrive only specific record
  • To delete only specific record
  • To update only specific record

Syntax

SELECT column_name,column_name
FROM table_name
WHERE column_name operator value;

Employee table

emp_idnamesalary
101Amit24000
102Rahul34000
103Sultan54000
104Gaurav26000
105Hitesh35000

Example

SELECT * from Employee
WHERE salary>30000;

Result after Execute above query.

emp_idnamesalary
105Hitesh35000
102Rahul34000
103Sultan54000

Operators in The WHERE Clause

WHERE clause uses some conditional selection, which is given below;

OperatorDescription
1=Equal
2<>Not equal. Note: In some versions of SQL this operator may be written as !=
3>Greater than
4<Less than
5>=Greater than or equal
6<=Less than or equal
7BETWEENBetween an inclusive range
8LIKEIt is used to search for a pattern
9INIt is used to specify multiple possible values for a column

Prev Tutorial Next Tutorial

Advertisements




Facebook Likes

Advertisements