WHERE

The WHERE clause allows you to specify a search condition for the rows returned by a query. The following shows the syntax of the WHERE clause:

SELECT 
    select_list
FROM
    table_name
WHERE
    search_condition;

The search_condition is a combination of one or more predicates using the logical operator AND, OR and NOT.

In MySQL, a predicate is a Boolean expression that evaluates to TRUE, FALSE, or UNKNOWN.

Any row from the table_name that causes the search_condition to evaluate to TRUE will be included in the final result set.

Besides the SELECT statement, you can use the WHERE clause in the UPDATE or DELETE statement to specify which rows to update or delete.

In the SELECT statement, the WHERE clause is evaluated after the FROM clause and before the SELECT clause.

Last updated