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 - 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
-
-
-
-
Retrieve data with SELECT5m 31s
-
(Locked)
Filter results with the WHERE clause5m 4s
-
(Locked)
Use LIKE, IN, and wildcards with WHERE5m 39s
-
(Locked)
Sort SQL results with ORDER BY1m 42s
-
(Locked)
Use string functions on your data6m 41s
-
(Locked)
More advanced string functions8m 35s
-
(Locked)
Change report headings with an alias2m 28s
-
(Locked)
Use date functions with WHERE8m 50s
-
(Locked)
Challenge: Query a table1m 7s
-
(Locked)
Solution: Query a table1m 23s
-
(Locked)
Challenge: Convert case50s
-
(Locked)
Solution: Convert case2m 30s
-
-
-
-
-