在Hive SQL中,可以使用WHERE子句进行数据过滤
SELECT column1, column2, ...
FROM table_name
WHERE condition;
其中,column1, column2, ...
表示要查询的列名,table_name
表示要查询的表名,condition
表示过滤条件。
以下是一些常见的过滤条件示例:
SELECT *
FROM table_name
WHERE column1 = 'value';
SELECT *
FROM table_name
WHERE column1 <> 'value';
SELECT *
FROM table_name
WHERE column1 > value;
SELECT *
FROM table_name
WHERE column1 < value;
SELECT *
FROM table_name
WHERE column1 >= value;
SELECT *
FROM table_name
WHERE column1 <= value;
SELECT *
FROM table_name
WHERE column1 BETWEEN value1 AND value2;
SELECT *
FROM table_name
WHERE column1 LIKE 'pattern';
SELECT *
FROM table_name
WHERE column1 IS NULL;
SELECT *
FROM table_name
WHERE column1 IS NOT NULL;
可以根据需要组合使用这些过滤条件。例如:
SELECT *
FROM table_name
WHERE column1 > 100 AND column1 <= 200 AND column1 LIKE 'A%';