WHERE clause select the record conditionally from SQl database. WHERE keyword use with different statement in SQL for example WHERE with SELECT Statement, Delete from statement, Update statement etc.
In This tutorial we explain WHERE clause with SELECT Statement. In SELECT Statement we give a condition with WHERE clause. Those record which satisfied the given were display.
For example if we have a table "student" with following record:
Name | Marks | Result | Grade |
Mr. Muneer | 500 | Pass | A |
Mr. Naweed | 300 | Pass | B |
Mr.tauqeer | 450 | Pass | A |
Mr. Jalil | 200 | Fail | Fail |
The above table contain the student result. if we want to display those record whose result is Pass then we use the following statement.
SELECT * FROM student WHERE Result='pass';
where
student is table name and result is column name and pass are the parameter
The above statment display the following records:
Name | Marks | Result | Grade |
Mr. Muneer | 500 | Pass | A |
Mr. Naweed | 300 | Pass | B |
Mr.tauqeer | 450 | Pass | A |
we can also use Like operator , > operator , != operator , between operator and in operator and < operator with WHERE clause.
We explain these operator in next tutorial:
Select Command
Distinct clause with Select Command
Where clause In SQL
Logical Operator in SQL SELECT Statement
IN Operator in SQL
BETWEEN Operator in SQL
Use of Wildcards in SQL
LIKE Operator in SQL
ORDER BY Clause in SQL
GROUP BY Clause in SQL
HAVING Clause in SQL
ALIAS In SQL
AS Keyword In SQL
INSERT INTO Command In SQL
Inserting Record In to a Table Form an other Table In SQL
UPDATE Command in SQL
DELETE Command in SQL
AVG Function in SQL