From the course: SQL Essential Training

Unlock the full course today

Join today to access over 23,100 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

- [Instructor] 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…

Contents