zoukankan      html  css  js  c++  java
  • insert 插入

    insert

    
    
    [ WITH [ RECURSIVE ] with_query [, ...] ]
    INSERT INTO table_name [ AS alias ] [ ( column_name [, ...] ) ]
        { DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }
        [ ON CONFLICT [ conflict_target ] conflict_action ]
        [ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]
    
    where conflict_target can be one of:
    
        ( { index_column_name | ( index_expression ) } [ COLLATE collation ] [ opclass ] [, ...] ) [ WHERE index_predicate ]
        ON CONSTRAINT constraint_name
    
    and conflict_action is one of:
    
        DO NOTHING
        DO UPDATE SET { column_name = { expression | DEFAULT } |
                        ( column_name [, ...] ) = ( { expression | DEFAULT } [, ...] ) |
                        ( column_name [, ...] ) = ( sub-SELECT )
                      } [, ...]
                  [ WHERE condition ]

    test=> insert into ask(id,publisherID,reward,cost,rangee,typee,label,content,image,createTime,zan,school,college) values
    test-> (1,1,4,10,'school','急问','学习','这道题怎么做','{"/icon/default.ico"}',now(),1,'广州大学',null),
    test-> (2,2,10,10,'school','急问','实习','xxx公司怎样','{"/icon/default.ico"}',now(),2,'广州大学',null),
    test-> (3,3,100,10,'college','急问','美食','xxx好不好吃','{"/icon/default.ico"}',now(),3,'广州大学','计算机科学与教育软件学院'),
    test-> (4,4,200,10,'college','急问','其它','xxx怎么去','{"/icon/default.ico"}',now(),4,'广州大学','计算机科学与教育软件学院'),
    test-> (5,3,100,10,'college','急问','美食','xxx好不好吃','{"/icon/default.ico"}',now(),5,'广州大学','人文学院'),
    test-> (6,4,200,10,'college','急问','其它','xxx怎么去','{"/icon/default.ico"}',now(),6,'广州大学','人文学院') on conflict do nothing;
    INSERT 0 4

    这里的on conflict是对于每一行来说的



  • 相关阅读:
    HTTP处理程序介绍
    c# Enum获取name,value和description
    如何成为优秀的软件人才
    关于系统设计分层
    从DLL中加载启动窗体
    摩斯密码
    休息下
    关于博文转载
    整合TextBox与Label 创建新控件EFLabelText
    ProC连接Oracle
  • 原文地址:https://www.cnblogs.com/cdyboke/p/7159711.html
Copyright © 2011-2022 走看看