Chrome Extension

In Operator MySQL

Using IN operator you can check whether column values exist in a list of values or in records of a subquery.
-- 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
);
We are a bunch of lazy programmers so we developed this chrome extension
search code from your favorite search engine
Install Now

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');

Search Index Data (The code snippet can also be found with below search text)

Select records if exists in a set of values MySQL
Was this helpful?
0 Comments
Open Code Manager We are hiring