網頁

2019/10/27

Oracle BETWEEN 與 小於等於且大於等於 差別

SQL語法中,查詢某個範圍內的條件語法常用BETWEEN v1 AND v2>= v1 AND <= v2,兩者有何不同?

BETWEEN v1 AND v2>= v1 AND <= v2其實效果相同。

例如下面兩個SQL皆是查詢age介於18與30間的member資料‘。

SELECT * member
WHERE age BETWEEN 18 AND 30;

SELECT * member
WHERE age >= 18 AND age <=; 30;

參考:

沒有留言:

張貼留言