在SQL中,BETWEEN操作符用于选择在指定范围内的值。以下是BETWEEN实际应用案例:
SELECT *
FROM orders
WHERE order_date BETWEEN '2021-01-01' AND '2021-12-31';
SELECT *
FROM products
WHERE price BETWEEN 50 AND 100;
SELECT *
FROM customers
WHERE age BETWEEN 30 AND 50;
SELECT *
FROM inventory
WHERE quantity BETWEEN 100 AND 500;
SELECT *
FROM movies
WHERE rating BETWEEN 7.0 AND 9.0;
通过以上案例可以看出,BETWEEN操作符可以方便地筛选出符合特定范围条件的数据,从而更加灵活地进行数据查询和分析。