From the course: Complete Guide to Analytics Engineering
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Filtering data results with the WHERE clause
From the course: Complete Guide to Analytics Engineering
Filtering data results with the WHERE clause
- [Narrator] Our imaginary stakeholder at Red30 Tech needs us to provide all of the sales that occurred for the following employee numbers, in both separate lists and also in one list. I've provided those employee IDs here marked in green. We can accomplish this by implementing a where clause in our select statement. Where clauses go directly after the from clause in the select statement. I'm going to remove the limit on this query and change the order by from order by total to order by date. I'm also going to add the employee ID columns so that we confirm that these sales are just for that employee. Let's begin. First, we'll remove the limit. Next, we'll order by OrderDate instead of OrderTotal. Let's add our new field, EmpID. We'll move our OrderDate field down the line. Make sure to separate them with commas. And now let's add our where clause. Remember, where comes after the from, and it works just like you might imagine, where EmpID =. And let's grab this first one here and enter…
Contents
-
-
-
-
-
-
-
-
(Locked)
Introduction to SQL for analytics engineering1m 17s
-
(Locked)
The SELECT statement4m 31s
-
(Locked)
Filtering data results with the WHERE clause9m 49s
-
Aggregate functions in SQL6m 51s
-
(Locked)
SQL date functions6m 28s
-
(Locked)
Inner joining multiple tables7m 26s
-
(Locked)
Left joining multiple tables8m 45s
-
(Locked)
Other types of SQL joins5m 18s
-
(Locked)
Common table expressions9m 30s
-
(Locked)
CoderPad solution: Modeling data with SQL37s
-
(Locked)
-
-
-
-