Login

Username:

Password: 

Join us Now |  Forgot Password? | Forgot UserName?

SQL

Learn step by step



Where Clause

WHERE Clause is used when we want to retrieve specific information from a table excluding other irrelevant data. Example we want to retrieve student data from student table where name is jai soni So SQL offers a feature called WHERE clause, from which we can restrict the data that is to be retrieved. The condition we provide in the WHERE clause filters the rows retrieved from the table and gives us only those rows which we expected to see. WHERE clause can be used along with DELETE, SELECT, UPDATE statements.
Syntax

SELECT <column_list> FROM table-name
WHERE <condition>;

Our Student Table

ID First_Name Last_Name Father_Name Age Address ContactNo
101 Jai Soni Dinesh Soni 23 jaipur, ram nagar b-007,h-786 4586859
102 Prakash tak Sivaji tak 34 delhi, rai nagar b-07,h-76 54886859
103 Ramesh jain Surajprakash jain 23 ajmer, suraj nagar b-258,h-746 1234568
104 Rahul Tanvar Dhyanchand tanvar 25 ajmer, ram nagar b-278,h-366 65489645
105 Aameer Khan aasif khan 26 mumbai, aajad nagar 1232584


select First_Name,Last_Name,Age,ContactNo from TblStudent where ID=101

Output

First_Name Last_Name Father_Name Age ContactNo
Jai Soni Dinesh Soni 23 4586859

we can select particular columns name from table query. in this example we not select address from table.


select First_Name,Last_Name,ContactNo from TblStudent where Age >23

Output

ID First_Name Last_Name ContactNo
104 Rahul Tanvar 65489645
105 Aameer Khan 1232584


Related Videos