Docy

MySQL IN Operator

Estimated reading: 1 minute 891 views

The MySQL IN Operator

The IN operator allows you to specify multiple values in a WHERE clause.

The IN operator is a shorthand for multiple OR conditions.

				
					SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1, value2, ...);
				
			

IN Operator Examples

The following SQL statement selects all customers that are located in “Germany”, “France” or “UK”:

				
					SELECT * FROM Customers
WHERE Country IN ('Germany', 'France', 'UK');
				
			

NOT IN Operator Examples

The following SQL statement selects all customers that are NOT located in “Germany”, “France” or “UK”:

				
					SELECT * FROM Customers
WHERE Country NOT IN ('Germany', 'France', 'UK');
				
			

Leave a Comment

Share this Doc
CONTENTS