From the course: MySQL Data Analysis

Unlock this course with a free trial

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

Solution: Combining WHERE and OR

Solution: Combining WHERE and OR - MySQL Tutorial

From the course: MySQL Data Analysis

Solution: Combining WHERE and OR

- [Instructor] This is the solution video for your assignment on using or in a multi-condition where clause. As a reminder, what we're trying to do here is pull all payment records for customers 42, 53, 60 and 75 alongside all payments over $5 from any customer. Let's jump into Workbench and try to do this. Here I've got the base query off of the payments table that we've been familiar with, pulling customer ID, rental ID, amount and payment date. And, so, we're going to need to include a where condition which gets us the data on those four customers that we care about, and all of the data that is over $5 amount. So I'm going to start with the amount first. So, here we've added in where amount is greater than five. If we just ran it now, this wouldn't include payments under a $5 amount from those four customers, so we need to include some kind of an or condition here. Alright, so now we've got five different criteria inside our where clause, separated with or. This will return any…

Contents