Hive3.0.0建库表命令测试

Hive创建表格格式如下:

create [external] table [if not exists] table_name

[(col_name data_type [comment col_comment],)]

[comment table_comment]

[partitioned by(col_name data_type [comment col_comment],)]

[clustered by (col_name,col_name,...) [sorted by (col_name [asc|desc],...)] into num_buckets BUCKETS]

[row format row_format]

[stored as file_format]

[location hdfs_path]

1、创建数据库

Create database sjl;

执行如下图所示:

2、创建内部表

create  table  if not exists  st_pptn_r_internal_text

(stcd  string,

  tm  string,

  drp  double,

  intv  string,

  pdr  string,

  dyp  double,

      wth  string)

stored as orc

tblproperties('transactional'='true')

执行如下图所示:

3、创建外部表

create external table  if not exists  st_pptn_r_external

(stcd  string,

    tm  string,

    drp  double,

    intv  string,

    pdr  string,

    dyp  double,

    wth  string)

location "/sjl"

执行如下图所示:

4、创建内部分区表

create  table  if not exists  st_pptn_r_internal_partition_text

( tm  string,

  drp  double,

  intv  string,

  pdr  string,

  dyp  double,

  wth  string)

partitioned by(stcd string)

执行如下图所示:

注意:由于stcd作为分区依据,所以stcd不要出现在字段中,否则报错如下:

5、创建外部分区表

create  external table  if not exists  st_pptn_r_external_partition

( tm  string,

      drp  double,

      intv  string,

      pdr  string,

      dyp  double,

      wth  string)

partitioned by(stcd string)

location "/sjl1"

执行如下图所示:

相关推荐

  1. hive占用空间大小的命令

    2024-04-08 09:38:05       45 阅读
  2. 將SqlServerhive腳本

    2024-04-08 09:38:05       45 阅读
  3. 將mysqlhive腳本

    2024-04-08 09:38:05       41 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-08 09:38:05       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-08 09:38:05       101 阅读
  3. 在Django里面运行非项目文件

    2024-04-08 09:38:05       82 阅读
  4. Python语言-面向对象

    2024-04-08 09:38:05       91 阅读

热门阅读

  1. svg 矢量图 在移动端 ios 模糊的处理方法

    2024-04-08 09:38:05       32 阅读
  2. redis哈希分桶路由介绍及代码示例

    2024-04-08 09:38:05       28 阅读
  3. CPU 架构:ARM 和 x86 架构区别

    2024-04-08 09:38:05       36 阅读
  4. uniapp小程序--录音功能

    2024-04-08 09:38:05       37 阅读
  5. 【算法-数组】有序数组的平方

    2024-04-08 09:38:05       37 阅读
  6. 比特币4种地址格式

    2024-04-08 09:38:05       32 阅读
  7. MyBatis 的 `<foreach>` 标签

    2024-04-08 09:38:05       38 阅读
  8. MFC中数据转化

    2024-04-08 09:38:05       29 阅读
  9. 文心一言 vs GPT-4 —— 全面横向比较

    2024-04-08 09:38:05       31 阅读
  10. Unity3D知识点精华浓缩

    2024-04-08 09:38:05       26 阅读
  11. Stable Diffusion 本地部署教程

    2024-04-08 09:38:05       36 阅读
  12. Python内置函数any()和ascii()详解

    2024-04-08 09:38:05       34 阅读