在Oracle中,使用BETWEEN關鍵字可以快速篩選出在指定范圍內的數據。以下是一些在Oracle中使用BETWEEN的技巧:
SELECT * FROM orders
WHERE order_amount BETWEEN 100 AND 200;
SELECT * FROM orders
WHERE order_date BETWEEN TO_DATE('01-01-2021', 'DD-MM-YYYY') AND TO_DATE('31-12-2021', 'DD-MM-YYYY');
SELECT * FROM orders
WHERE order_amount BETWEEN 100 AND 200
AND order_date BETWEEN TO_DATE('01-01-2021', 'DD-MM-YYYY') AND TO_DATE('31-12-2021', 'DD-MM-YYYY');
通過這些技巧,您可以更靈活地使用BETWEEN關鍵字來篩選出符合條件的數據。