To limit the number of rows use the WHERE clause.
The WHERE clause filters for rows that meet certain criteria.
WHERE is followed by a condition that returns either true or false.
WHERE is used with SELECT, UPDATE, and DELETE.
The SQL WHERE syntax
A WHERE clause with a SELECT statement:
A WHERE clause with an UPDATE statement:
SET column-name = value
A WHERE clause with a DELETE statement:
SQL WHERE Clause Examples
Problem: List the customers in Sweden
SELECT Id, FirstName, LastName, City, Country, Phone
WHERE Country = 'Sweden'
Problem: Update the city to Sydney for supplier Pavlova, Ltd.
SET City = 'Sydney'
WHERE Name = 'Pavlova, Ltd.'
Problem: Delete all products with unit price higher than 50.
DELETE FROM Product
WHERE UnitPrice > 50
Note: Referential integrity may prevent this deletion.
A better approach may be to discontinue the product, that is, set IsDiscontinued to true.