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

IDTitlePriceDescription
1Learn SQL20Learn SQL language
2Learn MySQL22Learn MySQL language
3HTML book17Learn HTML
4Learn PHP20Introduction to PHP
5Learn PHP20PHP course
SELECT * FROM coder_books WHERE price = 20;

Result

IDTitlePriceDescription
1Learn SQL20Learn SQL language
4Learn PHP20Introduction to PHP
5Learn PHP20PHP course