Computers & ProgrammingBackend DevelopmentSQL

SQL Where Clause

The WHERE clause is used to filter records, generally in combination with the SELECT statement. The WHERE clause is used to request only those records that fulfill a specified query.


SELECT column_name(s)
FROM table_name
WHERE column_name operator value

WHERE Clause Example

SELECT * FROM Customers
WHERE LastName='Smith' 

SELECT * FROM Customers

SQL uses single quotes around text values; some versions will allow double quotes.  Numeric values should not be enclosed in quotes. Operators Allowed in the WHERE Clause are as follows:

  • = – Equal
  • <> – Not equal
  • != – Not equal
  • > – Greater than
  • < – Less than
  • >= – Greater than or equal
  • <= – Less than or equal
  • BETWEEN = – Between an inclusive range
  • LIKE = – Search for a pattern
  • IN = – If you know the exact value you want to return for at least one of the columns

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top