Skip to Content
TheCornerLabs Docs

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:

1705252378428011 Image scaled to 70%

and we want to retrieve the records of a specific category:

SELECT * FROM Products WHERE category = 'Electronics';

Database Exercise

Database Schema:

-- Database schema would be rendered here

Exercise Script:

-- Exercise script would be rendered here

Available actions: Execute

The result of this query would be a table showing the following rows:

1705434596362021 Image scaled to 70%

Last updated on