From the course: SQL: Data Reporting and Analysis

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Use LIKE, IN, and wildcards with WHERE

Use LIKE, IN, and wildcards with WHERE - SQL Tutorial

From the course: SQL: Data Reporting and Analysis

Use LIKE, IN, and wildcards with WHERE

- [Instructor] Here we have a query, select star, select all fields, from the actor table where the first name is Penelope or Nick or Ed. And as you know, we have to repeat the column name which is a bit tedious for each of our filter conditions. And this query returns us 10 rows as you can see up here. There is a quicker way of doing this and that's to use the in keyword. So where first name in, and then Penelope, Nick, Ed and that's a lot quicker to type it out. And you can see it returns us the same 10 values there. Note from this query that we have single quotation marks around each of these names because they're all text items. So they all need their single quotes. So in means matches any of the following and you could also have, or alternatively have not in which gives us 190 rows, which makes sense, doesn't it? That 190 and 10 adds up to the 200 rows that we know are in that actor table. You can put as many values as you…

Contents