SQL WHERE Clause is used to retrieve specific records which matches the column names and values in WHERE clause. This SQL WHERE clause is used in any SQL statement, either it is SELECT, UPDATE, DELETE statements.

Here we will see a sample code for all SQL statements.


[sql] SELECT * FROM table_name WHERE column_name operator value;

SQL SELECT with WHERE Clause, select only specific column names.

[sql] SELECT column_name1, column_name2 WHERE column_name operator value;

UPDATE SQL with WHERE clause, UPDATE SQL statements only works with WHERE clause otherwise all the rows in that table will be updated.

[sql] UPDATE table_name
SET column1 = value1, column2 = value2…., columnN = valueN
WHERE column_name operator value;

DELETE SQL with WHERE clause, If you specify WHERE clause only specified records deleted otherwise all records in that will be deleted.

[sql] DELETE FROM table_name WHERE column_name operator value;

Operators Used in SQL WHERE clause

  • = : Equal to
  • != : Not Equal
  • > : Greater Than
  • >= : Greater than or Equal to
  • < : Less Than
  • <= : Less than or equal to
  • LIKE : Search for a pattern
  • BETWEEN : Between an range
  • IN : Multiple Possible values of Column
Vivek Vengala

Vivek Vengala is a Online Entrepreneur, Web Developer from Hyderabad India.