WHERE | BUS 104 – SQL Exam

WHERE explained

Congratulations guys! You've just scored a date with the girl of your dreams. Problem is, all your shirts are raggedy and old. You need a desperate upgrade before making a first impression on your date.

So, you hop online and go to CoolGuyShirts.com to find the perfect fit. You browse through the 6 shirt options and notice a filter on the left-hand side.

You'll utilize this filter to quickly determine what shirt you want to buy. First things first, you only want a shirt if it's got a 4-Star & Up rating. You need some high-class stuff!

The 4-star & Up selected on CoolGuyShirts.com filter

Next, you know you look good in red. So, you select the option to only see red shirts.

The red color selected on the CoolGuyShirts.com filter

But then you realize that blue might look good with your pants. So, you select that option as well.

The blue color also selected on the CoolGuyShirts.com filter

Perfect, now we've got 2 options to choose from.

In this situation, we utilized the filter to select 4-Star & Up shirts that are red or blue. We also essentially preformed a WHERE statement.

We took all of the shirts and defined conditions that each shirt must fit in order to be shown in the results.

WHERE statements are used to define conditions that each record must fit to be shown in the results.

How to code a WHERE

Here is the template for WHERE statements:

PAID CONTENT

This is the end of the preview. To unlock the rest, get the SQL Cram Kit or Lifetime Access.

Already purchased? Click here to log in.

Leave a Comment