SQL – Where Clause

Table Of Contents:

  1. What Is SQL Where Clause?
  2. Syntax Of Where Clause.
  3. Examples Of Where Clause.
  4. Where Clause Operations.

(1) What Is SQL Where Clause ?

  • Where clause is used to select the specific records for you.
  • It will only display the records you want to see.

(2) Syntax Of Where Clause ?

SELECT column1, column2, ...
FROM table_name
WHERE condition;

(3) Examples Of Where Clause ?

Demo Data:

Example-1:

SELECT * FROM Customers
WHERE Country='Mexico';

Example-2:

SELECT * FROM Customers
WHERE CustomerID=1;

(4) Where Clause Operations?

Example-3:

SELECT * FROM Products
WHERE Price = 18;

Example-4:

SELECT * FROM Products
WHERE Price BETWEEN 50 AND 60;

Example-5:

SELECT * FROM Customers
WHERE City LIKE 's%';

Leave a Reply

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