From the course: Oracle Database 12c: Basic SQL

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using WHERE IN and NOT IN for numbers

Using WHERE IN and NOT IN for numbers - Oracle Database Tutorial

From the course: Oracle Database 12c: Basic SQL

Start my 1-month free trial

Using WHERE IN and NOT IN for numbers

- [Instructor] The SQL where in and not in clause is not just limited to string values, we can also use it with numeric values for example. So let's start by selecting the first_name, last_name and department_id columns of our employees table. Assuming that we only want to see employees whose department_id is 90 or 100, we can just type where department_id in and type the department_id values, for example, 90 comma 100. Note that we don't have to place these values inside quotation mark because these are numeric values, numbers, and not string values. Running this query will give us the desired output, we only see employees assigned to department_id 90 and employees assigned to department_id 100. We can also change in to not in similarly to our previous example using string values. Running this query will provide us with the desired output, all employees who are not assigned to department_id 90 or 100, and of course we are not just limited to two values inside our brackets, we can…

Contents