美文网首页
mysql句型积累

mysql句型积累

作者: f9f73935e28c | 来源:发表于2016-12-12 14:04 被阅读0次
    1. 统计数量(去重)
      SELECT COUNT(DISTINCT common_name) FROM drug;

    2. load file

    > load data local infile 'file_path' into table test_table 
    > FIELDS TERMINATED BY '\t<FIELDS TERMINATED>\t' 
    > ENCLOSED BY ” ESCAPED BY ”
    > LINES TERMINATED BY '\n<LINES TERMINATED>\n'  
     > (field1,field2,field3,field4,field5,field6);
    

    若数据中有反斜杠,需要指定 ESCAPED BY ”

    1. mysql对json的支持
    2. SELECT json_extract(obj, '$.name') FROM table_name WHERE field1 =0 and json_extract(json_field, '$.name') is not null;
    3. update table_name set json_field = json_set(json_field, '$.country', '德国', '$.name', '乳糖') where id = 12505031;

    相关文章

      网友评论

          本文标题:mysql句型积累

          本文链接:https://www.haomeiwen.com/subject/uoummttx.html