• oracle数据库操纵语言DML


    oracle数据库操纵语言:DML
    添加数据:
    (1)直接添加数据:
        insert into table_name(column_name1,column_name2,...) values(data1,data2...);
    (2)通过其他数据表添加(目标表已存在):
        insert into table_name(column_name1,column_name2,...) select column_name1,column_name2... from table_name2;
    (3)添加数据同时创建表(目标表待创建):
        create table table_name as select column_name1,column_name2,...from source_table;
     
    修改数据:
        update table_name set column_name1=data1,column_name2=data2,... [where condition];
    
    删除表中数据:
    (1)条件删除:
        delete from table_name [where condition];
    (2)全部删除:
        truncate table table_name;
        
    同时修改和添加:
        merge [into] table_name1
        using table_name2 
        on (condition) 
        when matched then merge_update_clause 
        when not matched then merge_insert_clause;
    (1)省略增加的语句
        merge into login 
        using managerinfo 
        on (login.login_id = managerinfo.managerid)
        when matched then update 
        set login.loginname = managerinfo.loginname;
    (2)省略修改的语句
        merge into login 
        on(login.login_id=managerinfo.managerid) 
        when not matched then insert 
        values(managerinfo.loginname,managerinfo.password,managerinfo.managerid);
    (3)增加和修改同时进行
        merge into login 
        using managerinfo 
        on(login.login_id = managerinfo.managerid)
        when matched then update 
        set login.loginname = managerinfo.loginname 
        when not matched then insert 
        values(managerinfo.loginname,managerinfo.password,managerinfo.managerid);
  • 相关阅读:
    day10T3改错记
    day9T1改错记
    day8T1改错记
    洛谷P5068[Ynoi2015]我回来了(bfs+bitset)
    BZOJ4939[Ynoi2016]掉进兔子洞(莫队+bitset)
    [学习笔记]dsu on tree
    [学习笔记]FWT(快速沃尔什变换)
    [学习笔记]FMT(快速莫比乌斯变换)&子集卷积(待填坑)
    POJ-1743-Musical Theme(后缀数组)
    后缀数组模板
  • 原文地址:https://www.cnblogs.com/anningkang/p/9103250.html
Copyright © 2020-2023  润新知