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.
Challenge: COUNT and CASE - MySQL Tutorial
From the course: MySQL Data Analysis
Challenge: COUNT and CASE
- [Narrator] All right, time to test your skills with an assignment on the case pivot method using case and count. For this assignment, your business partner, Uncle Jimmy, is trying to figure out how many customers are inactive and active at each store. He'd like you to create a table which has the count of customers in it, and he wants it broken down by store ID, which should be the rows, and their active status, which should be the columns. Here's a preview of what your results should look like. Your job is to write the query using the case pivoting method that will produce these results. Keep in mind, this was a pro tip. It's a little more advanced, don't get frustrated. It's great if you can get this, but this may be one of the harder ones that you've had so far. Good luck.
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)
-
-
-