From the course: MySQL Data Analysis
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Common CASE operators - MySQL Tutorial
From the course: MySQL Data Analysis
Common CASE operators
- [Instructor] Now we're going to talk about which logical operators you can use inside a case statement and then we'll do a demo using a bunch of those operators together. The key thing to note here is all of the logical operators that you're familiar with in a where condition, you can also use inside your case statement. We've got equals, does not equal, greater than, less than, greater than equal to, less than equal to, between, like and in. Here's a query that uses a number of these operators. I'm going to jump into Workbench and walk you through it. Alright, so in this case example, I'm trying to figure out a good film to recommend to my niece. We walk through a few different cases here and first we say when rental duration is less than or equal to four days, then the rental is too short. I want her to have a little more time with the rental. When rental rate is greater than or equal to 3.99, then it's too expensive. We don't want her paying too much. When rating in NC17 or R…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
The CASE statement2m 43s
-
CASE example5m 43s
-
(Locked)
Common CASE operators4m 18s
-
(Locked)
Challenge: The CASE statement39s
-
(Locked)
Solution: The CASE statement3m 47s
-
(Locked)
Pro tip: Pivoting with COUNT and CASE2m 54s
-
(Locked)
COUNT and CASE demo7m 29s
-
(Locked)
Challenge: COUNT and CASE48s
-
(Locked)
Solution: COUNT and CASE3m 15s
-
(Locked)
-
-
-