HiveQL基础sql语法
时间: 2024-05-18 12:10:08 浏览: 139
Hive SQL语法总结
5星 · 资源好评率100%
HiveQL是一种基于SQL的查询语言,用于在Hadoop分布式环境中进行数据查询和分析。以下是HiveQL的基本语法:
1. 创建表:
```
CREATE TABLE table_name(
column_name1 data_type,
column_name2 data_type,
...
);
```
2. 插入数据:
```
INSERT INTO TABLE table_name
VALUES (value1, value2, ...);
```
3. 查询表中的所有数据:
```
SELECT * FROM table_name;
```
4. 查询表中的特定列:
```
SELECT column_name1, column_name2 FROM table_name;
```
5. 查询表中满足特定条件的数据:
```
SELECT * FROM table_name WHERE condition;
```
6. 对表进行聚合操作:
```
SELECT column_name, AGG_FUNC(column_name)
FROM table_name
GROUP BY column_name;
```
7. 对表进行排序:
```
SELECT * FROM table_name
ORDER BY column_name [ASC|DESC];
```
8. 对表进行连接操作:
```
SELECT * FROM table1 JOIN table2
ON table1.column_name = table2.column_name;
```
阅读全文