SQL Select IN

SQL Select IN is used to define multiple values in where clause.

This is used as a shortcut of OR in where clause.


Expression IN (value 1, value 2 ... value n);  



Take table Student

ID Name DOB City
23 Rahul 26-08-1994 Pathankot
24 Karan 14-10-1992 Mohali
25 Ajay 17-02-1995 Delhi
26 Nikhil 24-05-1994 Pathankot
27 mit 14-12-1993 Delhi


Query



SELECT *  
FROM students  
WHERE City IN ( Delhi , Mohali);  



Output
ID Name DOB City
24 Karan 14-10-1992 Mohali
25 Ajay 17-02-1995 Delhi
27 mit 14-12-1993 Delhi

Back To Top