SQL OR

SQL OR is used to fetch record if any one condition is true.

Syntax


SELECT column1, column2, column3..........,columnN FROM table_name 
WHERE condition1 OR condition2 OR condition3 . . . . . .  OR conditionN;



Take Table Student,

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


SQL Query with AND



SELECT * FROM Student WHERE StudentCity='Mohali' AND StudentCity='Chandigarh';



StudentID StudentName StudentCity
1 Rahul Chandigarh
2 Karan Mohali
4 Manpreet Chandigarh

Back To Top