Grokking SQL for Tech Interviews
0% completed
WHERE Clause
On This Page
WHERE
Syntax
Example
WHERE
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';
The result of this query would be a table showing the following rows:
Reading Progress
0%
On This Page
WHERE
Syntax
Example