zoukankan      html  css  js  c++  java
  • 插入数据、修改数据、删除数据

    1. 插入数据

      插入单个元组:

          insert

          into Student (Sno, Sname, Ssex, Sdept, Sage )

          values ('95020', '陈东', '男', 'IS', 18);

      插入一条记录(完整的):

          insert

          into Student

          values ('95020', …… , 18, 'CS');    //按顺序

      插入子查询结果:

          select 子句目标列必须与 into 子句匹配 

          insert

          into Deptage (Sdept, Avgage)

              select Sdept, AVG (Sage)

              from Student

              group by  ;

    2. 修改数据

      ① update Student          ③ update SC

        set sage = 22             set Grade = 0

        where Sno = '95001';         where 'CS' = ( select Sdept

                                from Student

      ② update Student                where Student.Sno = SC.Sno );

        set sage = sage + 1;

    3. 删除数据

      ① delete                 ③ delete

        from Student                from SC

        where Sno = '95019';           where 'CS' = ( select sdept

                                  from Student

      ② delete                       where Student.Sno = SC.Sno );

        from SC    //删除所有的学生选课记录

  • 相关阅读:
    Asp.net并发请求导致的数据重复插入问题
    记一次完整的asp.net-mvc页面优化过程
    设计完美的策略模式,消除If-else
    EF|CodeFirst数据并发管理
    mongo upsert
    js回调函数传参
    使用poi时,两个环境下,一个错误一直正常
    jna笔记1
    springboot集成rabbitmq测试
    一个方法让你了解js中的细节
  • 原文地址:https://www.cnblogs.com/zhangchaoran/p/6944155.html
Copyright © 2011-2022 走看看