语法:
test_expression BETWEEN begin_expression AND end_expression
例如:
数据库AA表中有一个字段AA_RQ,声明为,
Oracle版
AA_RQ VARCHAR2(8),
Sql Server版
AA_RQ VARCHAR(8),
以下两句话的效果一样:
select * from AA where AA_RQ between '20100101' and '20100104'
select * from AA where AA_RQ >='20100101' and AA_RQ<='20100104'
但如果将上面between...and..中的两个日期互换位置后,如:
select * from AA where AA_RQ between '20100104' and '20100101'
则查不出任何数据(对于Sql Server与Oracle均是如此),所以说:要注意between...and..两个表达式之间的关系。