zoukankan      html  css  js  c++  java
  • Sql练习201908210951

    表结构:

    create table SalePlan 
    (
        PlanId int identity(1,1) primary key,
        GoodsId int,
        PlanPrice decimal(18,2)
    );
    go
    
    create table Goods 
    (
        GoodsId int identity(1,1) primary key,
        Price decimal(18,2)
    );
    go

    原始数据:

    insert into Goods(Price)
    values(100);
    insert into Goods(Price)
    values(200);
    insert into Goods(Price)
    values(300);
    insert into Goods(Price)
    values(400);
    insert into Goods(Price)
    values(500);
    go
    
    insert into SalePlan
    values(1,0);
    insert into SalePlan
    values(2,0);
    insert into SalePlan
    values(3,0);
    insert into SalePlan
    values(4,0);
    insert into SalePlan
    values(5,0);
    go

    一条语句将销售计划的销售金额修改为商品表的价格:

    update s set s.PlanPrice = g.Price from SalePlan s,Goods g where s.GoodsId = g.GoodsId;
    go

    最终结果:

    完成.

    2015年10月-2016年3月 总计:5个月.
    2016年11月-2017年6月 总计:7个月.
    2017年7月-2018年4月 总计:9个月.
    2018年5月-2018年5月 总计:1个月.
    2018年6月-2018年12月 总计:6个月.
    2019年1月-2019年12月 总计11个月.
    2020年2月-2021年2月 总计13个月.
    所有总计:5+7+9+1+6+11+13=52个月(4年4个月).
    本人认同二元论.我是理想主义者,现实主义者,乐观主义者,有一定的完美主义倾向.不过,一直都是咸鱼(菜鸟),就算有机会,我也不想咸鱼翻身.(并不矛盾,因为具体情况具体分析)
    英语,高等数学,考研,其他知识学习打卡交流QQ群:946556683
  • 相关阅读:
    varnish反向代理
    Asp.Net MVC 3.0
    反向代理(Reverse Proxy)
    Go语言开发Windows应用
    Windows下安装NodeJS和CoffeeScript方法
    数据库设计....
    发布一个开源的c++网络事件库
    非小型电子商务系统设计经验分享 Coding changes the world
    SqlServer查询计划
    cocos2dx总结(一)HelloWord
  • 原文地址:https://www.cnblogs.com/JimmySeraph/p/11387088.html
Copyright © 2011-2022 走看看