Back to course home
0% completed
WHERE Clause
WHERE Clause
In MySQL, the WHERE
clause is used to filter the rows returned by a SELECT
, UPDATE
, or DELETE
statement. It allows you to specify a condition that must be met for a row to be included in the result set.
Syntax
The basic syntax of a WHERE
clause in a SELECT
statement is as follows:
SELECT column1, column2 FROM table_name WHERE condition;
Example
Suppose we have a Products
table as show below:
and we want to retrieve the records of a specific category:
SELECT * FROM Products WHERE category = 'Electronics';
MYSQL
MYSQL
. . . .
The result of this query would be a table showing the following rows:
Mark as Completed
Table of Contents
WHERE Clause
Syntax
Example