IN Operator
IN operator allows you to easily test if the expression matches any value in the list of values. It is used to remove the need for multiple OR conditions in SELECT, INSERT, UPDATE, or DELETE. You can also use NOT IN to exclude the rows in your list. We should note that any kind of duplicate entry will be retained.
Syntax:
SELECT column_name(s)
FROM table_name
WHERE column_name IN (list_of_values);
Find the Fname, and Lname of the Employees who have a Salary equal to 30000, 40000, or 25000.
Query:
SELECT Name FROM Emp WHERE Salary IN (30000, 40000, 25000);
Output:
Find the Fname and Lname of all the Employees who has a Salary not equal to 25000 or 30000.
Query:
SELECT Name FROM Emp WHERE Salary NOT IN (25000, 30000);
Output:
SQL | BETWEEN & IN Operator
Pre-requisites: SQL Operators
Operators are the foundation of any programming language. We can define operators as symbols that help us to perform specific mathematical and logical computations on operands. In other words, we can say that an operator operates the operands.
In this article, we will see BETWEEN & IN Operator of SQL.
Contact Us