IN Keyword
The IN keyword is used to specify a list of values which must be matched with the record values. In other words it is used to compare a column with more than one value. It is similar to an OR condition.
For example:
SELECT Admno, Name, Place FROM Student WHERE Place IN (“Chennai, “Delhi ”);
Admno |
Name |
Place |
100 |
Ashish |
Chennai |
101 |
Adarsh |
Delhi |
103 |
Ayush |
Delhi |
104 |
Abinandh |
Chennai |
105 |
Revathi |
Chennai |
107 |
Hema |
Chennai |
NOT IN:
The NOT IN keyword displays only those records that do not match in the list.
For example: SELECT Admno, Name, Place FROM Student WHERE Place NOT IN (“Chennai” , ‘ “Delhi”); will display students only from places other than “Chennai” and “Delhi”.
Admno |
Name |
Age |
102 |
Akshith |
Bangalore |
106 |
Devika |
Bangalore |