当前位置: 首页 > news >正文

扬州市住房和城乡建设局网站广告营销平台

扬州市住房和城乡建设局网站,广告营销平台,织梦iis7搭建网站,杭州app开发公司都集中在哪里目录 一、背景 二、准备测试数据 1.建表 2.造测试数据 三、操作 1.CTAS (1).无分区表测试 (2).分区表测试 2.LIKE (1).无分区表测试 (2).分区表测试 一、背景 有一张ori_…

目录

一、背景

二、准备测试数据

1.建表

2.造测试数据

三、操作

1.CTAS

(1).无分区表测试

(2).分区表测试

2.LIKE

(1).无分区表测试

(2).分区表测试


一、背景

有一张ori_table,想新建一张表new_table,保持跟ori_table一样的表结构,但是不复制ori_table的数据。

二、准备测试数据

1.建表

create table ori_table (
id   bigint,
col1 string,
col2 double
)comment '无分区原始表'
stored as orc;create table ori_table_partition (
id   bigint,
col1 string,
col2 double
)comment '有分区原始表'
partitioned by (dt string)
stored as orc;

2.造测试数据

insert into ori_table values (1,'哈哈',10.02);
insert into ori_table values (2,'嘿嘿',20.06);
insert into ori_table values (3,'嘻嘻',30.08);insert into ori_table_partition partition(dt='1') values (1,'哈哈',10.02);
insert into ori_table_partition partition(dt='2') values (2,'嘿嘿',20.06);
insert into ori_table_partition partition(dt='3') values (3,'嘻嘻',30.08);

三、操作

有2种办法

1.CTAS

(1).无分区表测试

--复制与ori_table表结构及表数据都一致的语句create table new_table as select * from ori_table;--只复制与ori_table表结构的语句
create table new_table as select * from ori_table where 1=0;

show create table new_table;   --执行看一下效果

 

select * from new_table;  --执行看一下数据量

 

由此得出结论,无分区表使用该语句可以满足需求!

(2).分区表测试

--复制与ori_table_partition表结构及表数据都一致的语句create table new_table_partition as select * from ori_table_partition;--只复制与ori_table表结构的语句
create table new_table_partition as select * from ori_table_partition where 1=0;

show create table new_table_partition;     --执行看一下效果

 

 这里看到表结构还是有些差异的,执行后将分区表建成了无分区表,分区字段创建成了普通字段。

select * from new_table_partition;   --执行看一下数据量

结论:

CTAS语法不适用于分区表

2.LIKE

(1).无分区表测试

--只复制与ori_table表结构的语句
create table new_table_like like ori_table;

show create table new_table_like;  --执行看一下效果

select * from new_table_like;   --执行看一下数据量

 

 

(2).分区表测试

--只复制与ori_table_partition表结构的语句
create table new_table_partition_like like ori_table_partition;

show create table new_table_partition_like; --执行看一下效果

 select * from new_table_partition_like;   --执行看一下数据量

结论:

LIKE语法适用于分区表及无分区表 

http://www.ds6.com.cn/news/3360.html

相关文章:

  • 刚做的网站怎么北京网站制作400办理多少钱
  • 网站公司怎么做推广方案小网站搜什么关键词
  • 个人官方网站怎么建设seo顾问服务公司站长
  • 公司网站优化外包百度竞价和优化的区别
  • 网站建设与维护书网络培训研修总结
  • 网站建设公司的市场营销方案模板下载广告公司品牌营销推广
  • 北京好的网站建设中国网新山东
  • php做网站教程网站推广策划方案
  • wordpress怎么引用图片网络优化seo是什么工作
  • 怎样python做网站百度app客服人工在线咨询
  • 网站邮箱配置郑州有没有厉害的seo顾问
  • 餐饮网站建设方案书免费推广网站有哪些
  • 廊坊做网站1766534168郑州seo推广优化
  • 武安网站建设网上销售推广方案
  • 建设银行宁波分行 招聘网站网络营销顾问
  • 法院举报网站建设的要求搜索引擎有哪些好用
  • 建网站需要服务器吗百度搜索推广怎么做
  • 口碑的经典句子seo的形式有哪些
  • 做做做做网站广州网页定制多少钱
  • 千里马招标网站百度视频排名优化
  • 专业建站源码全网关键词优化公司哪家好
  • 怎么做网站源码免费私人网站建设
  • 洛阳做网站的公司哪家好拓客平台有哪些
  • 做课件的网站有哪些网站如何做优化排名
  • 网站建设几个税点天津百度快速排名优化
  • 毕业设计代做网站多少钱网络营销的策略有哪些
  • 六安哪里有做网站的seo薪酬
  • 化妆品网站开发可行性百度最新推广产品
  • wordpress和discuz双向同步企业网站seo推广方案
  • 哪个外贸网站开发客户比较好用网络广告推广方案