between...and..

來源:互聯網
上載者:User

文法:

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..兩個運算式之間的關係。





相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.