Query
CREATE TABLE Emp(
EmpID INT PRIMARY KEY,
Name VARCHAR(50),
Country VARCHAR(50),
Age int(2),
Salary int(10) );
-- Insert some sample data into the Customers table
INSERT INTO Emp (EmpID, Name, Country, Age, Salary)
VALUES (1, 'Alok', 'India', '23', '30000'),
(2, 'Ankit ', 'Australia', '21', '45000'),
(3, 'Aditya', 'Sri lanka', '24', '40000'),
(4, 'Anamika', 'Austria', '25', '35000'),
(5, 'Aarohi', 'Spain', '22', '25000');
Select * from Emp;
Output
SQL NOT IN Operator
In SQL Server, the NOT IN operator replaces a set of arguments with the <> or != operator that is combined with the AND operator. This operator can be used to make code more readable and easier to understand for SQL statements like SELECT, UPDATE, and DELETE. In most cases, it won’t affect performance.
Syntax:
SELECT column_name(s)
FROM table_name
WHERE column_name NOT IN (list_of_values);
Let’s create a database to understand NOT IN Operator in SQL.
Contact Us