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 strings

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

From the course: Oracle Database 12c: Basic SQL

Start my 1-month free trial

Using WHERE IN and NOT IN for strings

- [Instructor] Using SQL where in and where not in, allows us to more easily filter data based on multiple conditions or criteria. So let's see an example. We'll start by selecting the first name, last name and job ID of all employees in our employees' table. Assuming that we only want to see employees that hold the AD VP or IT PROG job IDs. One way to do it would be to type where job id equals IT PROG or job id equals AD VP. While this is a fully functional and correct SQL query, we have an easier way of matching data based on multiple values. We can just type where job ID in and provide a list of all of the values we wish to filter our data based on. So for example, where job ID in, and inside brackets, IT PROG in quotation marks, comma, AD VP in quotation marks. Running this query will present us with the same data. We can add two, three, four or more values inside our brackets. We can also change job ID to not in instead of in, which will return us all rows from our employees…

Contents