hivesql create table
时间: 2024-02-04 22:02:50 浏览: 66
create table
5星 · 资源好评率100%
To create a table in HiveSQL, you can use the following syntax:
```
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
...
)
```
For example, to create a table called "employees" with columns for name, age, and salary, you could use the following code:
```
CREATE TABLE employees (
name STRING,
age INT,
salary FLOAT
)
```
You can also specify additional options like file format, partitioning, and storage location. Here's an example that creates a table with partitioning by year and month, and stores the data in the /data/employees directory:
```
CREATE TABLE employees (
name STRING,
age INT,
salary FLOAT
)
PARTITIONED BY (year INT, month INT)
STORED AS PARQUET
LOCATION '/data/employees'
```
阅读全文