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;
參考:
沒有留言:
張貼留言