< Sql Tutorial

Sql Where Clause

← Previous Next →


The WHERE clause is used to filter records.


The SQL WHERE Clause

The WHERE clause is used to extract only those records that fulfill a specified criterion.

SQL WHERE Syntax

SELECT column_name,column_name FROM table_name WHERE column_name operator value;

Example:

To find the name of a student with id 100, the query would be like:

SELECT first_name, last_name FROM student_details WHERE id = 100; 

Comparison Operators and Logical Operators are used in WHERE Clause.

Operators in The WHERE Clause

The following operators can be used in the WHERE clause:

Operator Description
= Equal
<> Not equal. Note: In some versions of SQL this operator may be written as !=
> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
BETWEEN Between an inclusive range
LIKE Search for a pattern
IN To specify multiple possible values for a column
← Previous Next →