建表约束

1.应用层建内部表,数仓表用外部表

2.存储格式一般选orcfile,除非需要直接load数据的表则选textfile

3.建表时要指定库名

hive的建表样例

create table if not exists 表名(

    字段名 字段类型 comment'字段描述'

   。。。。。。。。。。。。。。。。

,import_time string comment'数据入库时间'

)

row format delimited

fields terminated by '\t'

collection items terminated by ','

map keys terminated by ':'

stored as orcfile;

mysql的建表样例

create table if not exists 表名(

   字段名 字段类型 comment'字段描述'

  id varchar(60) character set utf8 collate utf8_bin default '' comment '编号'

 ,key idx_model(model)

 ,ket idx_model_level_2(model_level_2)

)engine=myisam default charset=utf8 comment'表名'

猜你喜欢

转载自www.cnblogs.com/lidapengwww/p/12036462.html