首页 > 其他分享 >每日总结

每日总结

时间:2023-11-13 10:56:40浏览次数:26  
标签:总结 string nbr 每日 sale day table id

今天我对大型数据库练习题进行了复习,

 

相关sql代码如下:

create database db001;
create table sale_sample(
day_id string comment '日期编号',
sale_nbr string comment '卖出方代码',
buy_nbr string comment '买入方代码',
cnt string comment '数量',
round string comment '金额'
)row format delimited
fields terminated by ',';

load data inpath '/sale_sample/data/104W' into table sale_sample;
drop table sale_sample;

insert overwrite table sale_sample select date_add('2021-09-00',cast(day_id as int)) as day_id,sale_nbr as sale_nbr,buy_nbr as buy_nbr,cnt as cnt,round as round from sale_sample;

select * from sale_sample tablesample ( 600 rows );

create table jichang(day_id string,sale_nbr string,cnt string,round string) row format delimited fields terminated by ',';

insert into table jichang select day_id,sale_nbr,sum(cnt) as cnt,sum(round) as round from sale_sample group by sale_nbr,day_id having sale_nbr like 'C%';

create table dailishang(day_id string,sale_nbr string,cnt string,round string) row format delimited fields terminated by ',';

insert into table dailishang select day_id,sale_nbr,sum(cnt) as cnt,sum(round) as round from sale_sample group by sale_nbr,day_id having sale_nbr like 'O%';

create table dailishang_mc(day_id string,sale_nbr string,count int) row format delimited fields terminated by ',';

insert into table dailishang_mc select day_id,sale_nbr,count(*) as count from sale_sample where sale_nbr like 'O%' group by sale_nbr,day_id;

create table dailishang_mr(day_id string,sale_nbr string,count int) row format delimited fields terminated by ',';

insert into table dailishang_mr select day_id,buy_nbr as sale_nbr,count(*) as count from sale_sample where buy_nbr like 'O%' group by buy_nbr,day_id;

create table dailishang_h(day_id string,sale_nbr string,sale_number int) row format delimited fields terminated by ',';

create table daiout(day_id string,sale_nbr string,cnt int,round int) row format delimited fields terminated by ',';

create table daiin(day_id string,buy_nbr string,cnt int,round int) row format delimited fields terminated by ',';

insert into table daiout select day_id,sale_nbr,sum(cnt) as cnt,sum(round) as round from sale_sample where sale_nbr like 'O%' group by day_id,sale_nbr;

create table daili(day_id string,sale_nbr string,incnt int,inround int,outcnt int,outround int,lirun int) row format delimited fields terminated by ',';

insert into table daili select daiout.day_id as day_id,daiout.sale_nbr as sale_nbr,daiin.cnt as incnt,daiin.round as inround,daiout.cnt as outcnt,daiout.round as outround,daiout.round-daiin.round as lirun from daiout join daiin on (daiin.buy_nbr=daiout.sale_nbr);

标签:总结,string,nbr,每日,sale,day,table,id
From: https://www.cnblogs.com/baijingyun/p/17828662.html

相关文章

  • Java语言基础知识全总结
    一.Java的优点1.      跨平台性。一次编译,到处运行。Java编译器会将Java代码编译成能在JVM上直接运行的字节码文件,C++会将源代码编译成可执行的二进制代码文件,所以C++执行速度快2.      纯面向对象。Java所有的代码都必须在类中书写。C++兼具面向对象和面向过程的特......
  • 11.13每日总结
    今天早上进行了软件设计模式的上机实验[实验任务一]:计算机开启在计算机主机(Mainframe)中,只需要按下主机的开机按钮(on()),即可调用其他硬件设备和软件的启动方法,如内存(Memory)的自检(check())、CPU的运行(run())、硬盘(HardDisk)的读取(read())、操作系统(OS)的载入(load()),如......
  • 每日博客
    实验12:外观模式  实验13:享元模式    ......
  • 11月13每日打卡
    实验13:享元模式本次实验属于模仿型实验,通过本次实验学生将掌握以下内容:1、理解享元模式的动机,掌握该模式的结构;2、能够利用享元模式解决实际问题。 [实验任务一]:围棋设计一个围棋软件,在系统中只存在一个白棋对象和一个黑棋对象,但是它们可以在棋盘的不同位置显示多次。实......
  • 每日总结
    实验12:外观模式本次实验属于模仿型实验,通过本次实验学生将掌握以下内容:1、理解外观模式的动机,掌握该模式的结构;2、能够利用外观模式解决实际问题。Client:packagetutorial12;publicclassClient{     publicstaticvoidmain(String[]args){        //T......
  • 学期2023-2024-1 20231409 《计算机基础与程序设计》第七周学习总结
    学期2023-2024-120231409《计算机基础与程序设计》第七周学习总结作业信息这个作业属于哪个课程2023-2024-1-计算机基础与程序设计这个作业要求在哪里2023-2024-1计算机基础与程序设计第七周作业这个作业的目标自学教材:数组与链表,基于数组和基于链表实现数据结构,......
  • 2023年11月12日每日随笔
    今天,主要进行了ERP的系统的主要功能的揣摩和学习,对于博欧ERP的网站进行参考,可能我的能力不够吧,对于支出收入,那里面的功能我一点也不理解,我中感觉把题目改成输入输出好,接受外界信息,修改外界信息等等,也在网上找到了许多的参考,对于分摊工资也进行了大概了解,有着具体的思路,但是想找一......
  • 11月6号总结
    今天又是一个新的一周,上周末参加婚礼回家爽了两天还没缓过进来,早上又是一如既往的实训课程,学会了家庭电路的简单排线。下午学习了java的语法知识之后有练习了还是之前的数据结狗连接。还是得继续练习熟能生巧。de ......
  • 2023-2024-1学期20232412《网络空间安全导论》第十周学习总结
    教材学习内容总结本周主要学习《网络空间安全导论》第一章的内容,初步了解了网络空间安全的概念以及学科所覆盖的内容,了解了相关的法律法规,并且接触了之前从未了解的信息安全标准。通过第一章的学习,我也正式开始对我们专业的学习,认识到网络空间安全的重要性,掌握了计算机学习与其他......
  • 2023-2024-1 20232421 《网络空间安全导论》第10周学习总结
    教材学习总结国内外网络安全的现状网络空间安全的内容网络空间安全受到重视的原因课程涵盖内容思维导图教材学习中的问题和解决过程问题1:混淆信息安全与网络空间安全的概念,并执着于将其区分开。问题1解决办法:研读教材:教材中由信息安全引出网络空间安全,援引信息论的论述......