SQL – WHERE Clause (to filter data)

SQL - WHERE Clause (to filter data)

SQL – WHERE Clause: Here, we will figure out how to channel information from a table (it is utilized to check conditions).

WHERE provision is utilized to channel the information by methods for conditions. It is utilized to get records that satisfy specific criteria. WHERE condition can be utilized with SELECT, UPDATE, DELETE and so on.

Syntax:

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

Here,

  • column1, column2,… : is the name of the fields in the table
  • table_name: name of the table from which we need to get information
  • condition: this condition is utilized to channel the information. It very well may be break into three sections (Column_name administrator value).

Test table (Student),

SQL - WHERE Clause (to filter data)

1) Fetch Student whose material science marks are 91

SELECT * FROM Student WHERE physics=91;
SQL - WHERE Clause (to filter data)

2) Fetch Student whose DOB is between 1997-06-01 and 1998-11-01

SELECT * FROM Student WHERE DOB BETWEEN '1997-06-01' and '1998-11-01';

Will Fetch understudy whose DOB lies in the middle of the given dates both comprehensive.

SQL - WHERE Clause (to filter data)

3) Fetch Student where the city is Delhi and Gwalior

SELECT * FROM Student WHERE City IN ('Gwalior', 'Delhi');

Will bring understudies who live in Gwalior and Delhi.

SQL - WHERE Clause (to filter data)

4) Fetch Student whose name starts with ‘a

SELECT * FROM Student WHERE Student_name LIKE 'A%';

This will get understudies whose name begins with ‘A‘.

SQL - WHERE Clause (to filter data)

Recent Posts

error: Alert: Content is protected!!