SQL WHERE clause in database systems

By: Prof. Dr. Fazal Rehman | Last updated: March 3, 2022

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

Leave a Comment

All Copyrights Reserved 2025 Reserved by T4Tutorials