How SQL BETWEEN options are used
The between relationship uses the WHERE clause to select values between the various data.
The relationship of between
And between's choice of a series of data between the values of the two countries. Values can be numeric, literal, or date.
The SQL syntax between
SELECT column_name (s) from
table_name
WHERE column_name
BETWEEN value1 and value2
Now let's take a look at an example.
p_id |
LastName |
FirstName |
| Address
| City
1 |
Hansen |
Ola |
TIMOTEIVN 10 |
Sandnes |
2 |
Svendson |
Tove |
BORGVN 23 |
Sandnes |
3 |
Pettersen |
Kari |
STORGT 20 |
Stavanger |
Now we want to select the names of the people in alphabetical order "Hanson" and "Paterson" from the above table.
We use the following SELECT statement:
select * from Persons WHERE LastName BETWEEN ' Hansen ' and ' Pettersen '
&N
BSP;
The
results are the following table.
TIMOTEIVN
city |
1 |
Hansen |
Ola |
sandnes |
NOTE: Reprint please specify From www.111cn.net/database/database.html