How to use "not in" operator in oracle cmd?

by wilmer.lemke , in category: Third Party Scripts , a day ago

How to use "not in" operator in oracle cmd?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by raven_corwin , 3 hours ago

@wilmer.lemke 

In Oracle SQL, you can use the "NOT IN" operator to filter results based on values that are not present in a specific list of values.


Here's an example of using the "NOT IN" operator in an Oracle command:

1
2
3
SELECT column_name
FROM table_name
WHERE column_name NOT IN (value1, value2, value3);


In this example, replace "column_name" with the name of the column you want to filter, "table_name" with the name of the table you are selecting from, and "value1, value2, value3" with the specific values that you want to exclude from the results.


For example, if you want to select all employees whose department is not HR or IT, you can write a query like this:

1
2
3
SELECT employee_name
FROM employees
WHERE department_name NOT IN ('HR', 'IT');


This query will return the names of all employees whose department is not HR or IT.