Case statements.
We practice this a little bit in lab 1.3.
If you were unsure of what to do and why, just practice with it.
So what we're looking at over here,
we can see we have a database called 585-instructors.
And it seems like there's a lot of information
in here, different email addresses, different contacts.
What do you do when you want to go and look at this?
So if we look, we can see, OK, the query
says select, first, last, address, type, from,
instructors.
And it gives us those results.
However, it doesn't tell us what the type means.
So as you're looking down that, that could be really confusing.
We added a case statement.
So we said case when type equals 1,
then it's email, when type equals 2 then phone, when
type equals 3 then physical location, end
as case statement.
So here we can see it's the case statement,
and now we have words with it.
Do not be intimidated to try this.
It makes the query so much more tangible
to someone who's just going to read your output
and try to make sense of it.
Imagine if you gave your parents this screenshot in the middle,
and they were trying to make sense
of what 555 Lucky Lane San Diego, California means.
It may not make any sense.
But if they see that, and they're like,
oh, it's a physical location, they
could think that 123 is an order.
Just do not cause confusion by not doing a case statement.