Click here to Skip to main content
15,846,727 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
What is the meaning of IN and NOT IN in sql command?
Posted
Updated 21-Aug-13 3:31am
v3
Comments
[no name] 21-Aug-13 8:31am    
Was the documentation unclear somehow?

Your question title & question content .... not matching.

Regarding duplicate rows in table, you could use DISTINCT keyword. For example Employee table has tons of records with details such as employee id, name, designation, department, etc., Now, if you want to display list of designations, use the following query.
SQL
SELCT DISTINCT EMP_DESIGNATION FROM TABLE_EMP

IN( & NOT IN) keywords are used to specify criteria in WHERE clause.
SQL
SELECT *
FROM TABLE_EMP
WHERE EMP_DESIGNATION IN ('Manager','Supervisor');

Above query will display all employees who're Manager or Supervisor. NOT IN works opposite way of IN like it'll display all employees who're not Manager or Supervisor.
 
Share this answer
 
Refer these links

SQL IN Operator[^]

EXCEPT vs NOT IN in SQL Server[^]

Regards..:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900