SQL WHERE clause in database systems

By Prof. Fazal Rehman Shamil
Last modified on May 27th, 2019

What is WHERE clause?

Where clause filters the record from a table according to given condition.

RollNo Name Fee
1 Sameed 10,000
2 Shahzeb 10,000
3 Basit 0.00

Table 1: student

Example 1 of WHERE clause

Query:

SELECT * FROM student  WHERE Name = ‘sameed’;

Note: This will display values from all the table WHERE Name is sameed.

Result:

RollNo Name Fee
1 Sameed 10,000

Query displays the resultant table: student


Example 2 of WHERE clause

Query:

SELECT * FROM student  WHERE Fee = ‘10,000’;

Note: This will display values from all the table WHERE Fee is 10,000.

Result:

RollNo Name Fee
1 Sameed 10,000
2 Shahzeb 10,000

Query displays the resultant table: student


Example 3 of WHERE clause

Query:

SELECT * FROM student  WHERE Fee <  10000;

Note: This will display values from all the table WHERE Fee is less than 10,000.

Result:

RollNo Name Fee
3 Basit 0.00

Query displays the resultant table: student

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.