CREATETABLETestBteween(
Col 1varchar(200)NOTNULL,
Col2varchar(200)NULL,
Col3intNULL
)
2. insert a few lines of test data into the test table TestBetween.
Inserttestbteween (col 1, col2, col3) values ('line 1',' Hello',10);
Inserttestbteween (col 1, col2, col3) value ('line 2',' World', 20);
Inserttestbteween (col 1, col2, col3) value ('line 3', null, null);
Inserttestbteween (col 1, col2, col3) values ('line 4',' Hello', 40);
Inserttestbteween (col 1, col2, col3) value ('line 5',' World', 50);
3. Query all the test data in the table.
select * fromTestBteween
4. Using the results of Col3 numbers between ... and 10 and 40, it can be seen from the running results that 10 and 40 are both included in the query results, indicating that the query results between ... contain boundary values.
select * fromtestbteweenwherecol 3 between 10 and 40;
5. Use ... between and query the result of Col3 number between 10 and 30. As can be seen from the results, as long as it is equal to a boundary value, it will be queried.
select * fromtestbteweenwherecol 3 between 10 and 30;
6. Using the result of the Chinese column in col 1 between ... and line1and line 3, we can see that it also contains boundary values.
Select * fromtestbteweenwherecol 1 between "line1"and "line 3";
7. Use the result of the Col2 English column between ... and the query between Hello and World. It can be seen from the result that it also contains boundary values.
Choose between "Hello" and "World" * fromtestbeenween between 2.