From the course: SQL Essential Training

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

BETWEEN and IN operators

BETWEEN and IN operators - SQL Tutorial

From the course: SQL Essential Training

BETWEEN and IN operators

Now, let's say there was a twist to our scenario in that WSDA Music Management is pretty happy with us finding out how many customers purchased two songs at 99 cents each, but now they'd like to know how many invoices exist between $1.98 and $5. Let's see how we would use SQL to respond to such a question. Well, to respond to this request, we would simply have to make an alteration to our where clause. Currently it's saying total equal to $1.98, but since the request wants to find records that exist between $1.98 and $5, we're simply going to include the logical operator between $1.98 and $5. By altering our where clause to include the logical operator between the other keyword and we're effectively responding to this question, how many invoices exist between $1.98 and $5. Now, before I run this, let's take a look at our total, which is currently 111 rows. and let's see our result now that I'm going to hit Execute. We have now gone to 178 rows and we do see in our total, we have our…

Contents