-- Match with list values
SELECT
first_name,
last_name,
city
FROM
Students
WHERE
city IN ('Delhi' , 'Newyork');
--Match with subquery records
SELECT
first_name,
last_name,
city
FROM
Students
WHERE city IN
(
SELECT
city
FROM
city_list
);
You can also use the NOT IN operator to select records that do not exist in a set of values. The example MySQL query can be written as below.
SELECT
first_name,
last_name,
city
FROM
Students
WHERE
city NOT IN ('Delhi' , 'Newyork');
0 Comments