zoukankan      html  css  js  c++  java
  • 27 修改数据:update

    27 修改数据:update
        
        语法格式:
            update 表名 set 字段名1=值,字段名2=值2... where条件;
            
        注意:没有条件整张表数据全部更新。
        
        案例:将部门10的LOC修改为shanghai,将部门名称修改为renshibu。
        update dept1 set loc = 'shanghai',dname='renshibu' where deptno = 10;
        
        select * from dept1;
            +--------+------------+----------+
            | DEPTNO | DNAME      | LOC      |
            +--------+------------+----------+
            |     10 | renshibu   | shanghai |
            |     20 | RESEARCH   | DALLAS   |
            |     30 | SALES      | CHICAGO  |
            |     40 | OPERATIONS | BOSTON   |
            |     10 | renshibu   | shanghai |
            |     20 | RESEARCH   | DALLAS   |
            |     30 | SALES      | CHICAGO  |
            |     40 | OPERATIONS | BOSTON   |
            +--------+------------+----------+
            
        更细所有记录
            update dept1 set loc = 'x',dname = 'y';
                select * from dept1;
                +--------+-------+------+
                | DEPTNO | DNAME | LOC  |
                +--------+-------+------+
                |     10 | y     | x    |
                |     20 | y     | x    |
                |     30 | y     | x    |
                |     40 | y     | x    |
                |     10 | y     | x    |
                |     20 | y     | x    |
                |     30 | y     | x    |
                |     40 | y     | x    |
                +--------+-------+------+
  • 相关阅读:
    ES6变量的解构赋值
    ES6新增内容
    Rvalue references
    range-based for statement
    Space in Template Expression, nullptr, and auto
    Type Alias、noexcept、override、final
    Variadic Template
    =default =delete
    为什么不要特化函数模版?
    boost::noncopyable 的作用
  • 原文地址:https://www.cnblogs.com/xlwu/p/13639755.html
Copyright © 2011-2022 走看看