首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

SQL话语中between and 范围

2012-07-28 
SQL语句中between and 范围经过验证 SQL语句中的between 范围1 and范伟2语句是包括的范围1和范围2的SQL c

SQL语句中between and 范围


经过验证 SQL语句中的between 范围1 and  范伟2 
语句是包括的范围1和范围2的


SQL> create table test  2  (  3  test1 number(2)  4  );表已创建。SQL> insert into test values(1);已创建 1 行。SQL> insert into test values(2);已创建 1 行。SQL> insert into test values(10);已创建 1 行。SQL> commit;提交完成。SQL> select * from test where test1 between 1 and 10;     TEST1----------         1         2        10




mysql> use mldnDatabase changedmysql> create table test    -> (    ->   test1 int    -> );Query OK, 0 rows affected (0.69 sec)mysql> insert into test values(1);Query OK, 1 row affected (0.10 sec)mysql> insert into test values(2);Query OK, 1 row affected (0.00 sec)mysql> insert into test values(10);Query OK, 1 row affected (0.00 sec)[size=xx-large]观察此处:[/size]mysql> select * from test where test1 between 1 and 10;+-------+| test1 |+-------+|     1 ||     2 ||    10 |+-------+3 rows in set (0.07 sec)mysql> alter table test modify test1 varchar(10);Query OK, 3 rows affected (0.27 sec)Records: 3  Duplicates: 0  Warnings: 0mysql> insert into test values('a');Query OK, 1 row affected (0.04 sec)mysql> insert into test values('d');Query OK, 1 row affected (0.02 sec)mysql> insert into test values('z');Query OK, 1 row affected (0.02 sec)mysql> commit;Query OK, 0 rows affected (0.00 sec)[size=xx-large]观察此处:[/size]mysql> select * from test where test1 between 'a' and 'z';+-------+| test1 |+-------+| a     || d     || z     |+-------+3 rows in set (0.02 sec)

热点排行