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    |
                +--------+-------+------+
  • 相关阅读:
    POJ 3258 (NOIP2015 D2T1跳石头)
    POJ 3122 二分
    POJ 3104 二分
    POJ 1995 快速幂
    409. Longest Palindrome
    389. Find the Difference
    381. Insert Delete GetRandom O(1)
    380. Insert Delete GetRandom O(1)
    355. Design Twitter
    347. Top K Frequent Elements (sort map)
  • 原文地址:https://www.cnblogs.com/xlwu/p/13639755.html
Copyright © 2011-2022 走看看