SQL Where

SQL Where

The SQL WHERE is used to return records that meet the conditions in a select query.

Where syntax

-- select the records that meet the condition
SELECT * FROM table_name WHERE {condition}

SELECT * FROM view_name WHERE {condition}

Where example

Coder books table

ID Title Price Description
1 Learn SQL 20 Learn SQL language
2 Learn MySQL 22 Learn MySQL language
3 HTML book 17 Learn HTML
4 Learn PHP 20 Introduction to PHP
5 Learn PHP 20 PHP course
SELECT * FROM coder_books WHERE price = 20;

Result

ID Title Price Description
1 Learn SQL 20 Learn SQL language
4 Learn PHP 20 Introduction to PHP
5 Learn PHP 20 PHP course