From the course: MySQL Data Analysis
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Solution: The CASE statement - MySQL Tutorial
From the course: MySQL Data Analysis
Solution: The CASE statement
- [Instructor] This is the solution video for the case statement assignment. As a reminder, Uncle Jimmy wants first and last names of all customers and he wants them labeled as store 1 active, store 1 inactive, store 2 active, or store 2 inactive. This is the result grid we're trying to go for with first name, last name, and status. Let's go over to Workbench and walk through the solution. So the first thing we're going to do is figure out where our data lives that we need to work with. Checking out our tables, we know that we're working with customers and which store that they're in, and activity status is something we're looking for. So looking through here, could be customer, could be store. Let's take a look at both of those. And our columns, we have the first name, last name. Those are something that we needed. The store ID is something Jimmy wanted in the status, and they're active state. So looks like this is it. Let's go and write a query on that. So first I'm just doing…
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)
-
-
-