SQL WHERE clause in database systems

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

Fazal Rehman Shamil
Welcome to all friends. The reason for our success is only your love for T4Tutorials. Our team is always available to answer your queries regarding any kind of confusions or discussion regarding your study and career matters. For discussion with us please join our facebook group "T4Tutorials.com". The link of the group is mentioned below. Thanks and love to all for connecting with us. We are nothing without you. Love you all.....
https://web.facebook.com/groups/2066136233601097/

Leave a Reply