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.
Solution: Query a table - SQL Tutorial
From the course: SQL: Data Reporting and Analysis
Solution: Query a table
(upbeat music) - [Instructor] For this query, we can interpret each line of our objective into a line of code so we can build the query up line by line. The first part was to return all records from the film table. And that's what happens when we click on the film table anyway, select star from film. So we run that and we have a thousand rows returned. Next, we need to place a filter using the where claws. We can either use rating in brackets with the in key word or we could use the or statement, which I'm not going to show you. Either of these is fine, but if you use the or statement you might need parentheses around part of your where clause. So select star from film where rating in G, PG, and we can run that. Finally, for the second filter, we use the and keyword and a wild card, which is the percent sign in this case. So we're going to say and description like percent drama percent. And let's run that as well.…
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
-
-
-
-
-