zoukankan      html  css  js  c++  java
  • load data妙用

    load变量和用户变量的巧妙结合,实现灵活导入字段列
    (NO.1)

    LOAD DATA INFILE 'file.csv' INTO TABLE dados_meteo
    (@var1, @var2)
    SET column1 = REPLACE(@var1, ',', '.'), column2 = REPLACE(@var2, ',', '.')
    

     (no.2)

    LOAD DATA infile '/usr/local/src/cre_tab/report02.csv' 
    REPLACE INTO TABLE `table_metadata_info` character set gbk FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '\' LINES TERMINATED BY '
    ' 
    IGNORE 1 LINES (@var1,@var2,@var3,@var4,@var5,@var6,@var7,@var8) 
    set table_name=rtrim(ltrim(@var1)),column_name_comment=rtrim(ltrim(@var4)),column_name=rtrim(ltrim(@var3)),
     column_type=rtrim(ltrim(@var5)), constraints=rtrim(ltrim(@var6)),default_value=rtrim(ltrim(@var7));
  • 相关阅读:
    jenkins更换国内源
    部署jdk和maven
    Prometheus监控Nginx
    Prometheus监控MySQL
    MySql里动态视图的实现
    MySql里split函数的实现
    HTML编码规范
    消弱反驳18招
    Pr2020
    记忆准则
  • 原文地址:https://www.cnblogs.com/janehoo/p/5583364.html
Copyright © 2011-2022 走看看