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

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…

Contents