SQL BETWEEN OPERATOR

SQL BETWEEN OPERATOR

SQL BETWEEN OPERATOR

The BETWEEN Operator The Between Operator selects a range of data between two values. The values can be numbers, text, or dates

SYNTAX

SELECT Column_name(S)FROM table_ name WHERE Column_name 

BETWEEN value1 AND Value2

EXAMPLE

P_Id       LastName      FirstName     Address          City

1             Jameson        John              Streets          Sander

                                                            15

2              Smith            Kate              Green            Sander

                                                           68

3            Kristensen      Olya              Ski 2               Stavn

Now we want to select the persons with a last name alphabetically between 

“Jameson” and ” Kristensen” from the table above.

EXAMPLE

SELECT*FROM Persons WHERE LastName BETWEEN ‘Jameson’ AND 

‘Kristensen’

RESULT

P_Id   LastName       FirstName            Address             City

1      Jameson               John                Streets 15         Sander

Leave a Reply

Your email address will not be published.