SQL Where

SQL Where clause is used to fetch record from table with certain conditions.

SQL Where is used to filter records.

Syntax


SELECT column_name1, column_name2, column_name3, .. . . .. . . . , column_nameN 
FROM table_name WHERE condition;


Note: WHERE is not only used in SELECT. It can also be used in UPDATE, DELETE statements.



StudentID StudentName StudentCity
1 Rahul Chandigarh
2 Karan Mohali
3 Neha Delhi
4 Manpreet Chandigarh
5 Ajay Delhi


Query Match With Numeric



SELECT * FROM Student WHERE StudentID='2';



StudentID StudentName StudentCity
2 Karan Mohali


Query Match With String



SELECT * FROM Student WHERE StudentCity='Chandigarh';



StudentID StudentName StudentCity
1 Rahul Chandigarh
4 Manpreet Chandigarh

Back To Top