美文网首页
mysql:增,删,查,改

mysql:增,删,查,改

作者: adtk | 来源:发表于2017-01-11 18:03 被阅读0次

    增:

    INSERT INTO `tian` (`id`,`num`) values (null,'" + (addNum + 1) + "');
    

    删:

    //快速删除表,返回0
    truncate table 表名
    
    //返回被删除的记录数
    DELETE FROM 表名 
    DELETE FROM `表名 ` WHERE `id` = 1 ;
    

    改:

    update `tian` set name="天域苍穹" WHERE `id`>=0 ;
    

    查:

    "SELECT num FROM `表名` ORDER BY id DESC  LIMIT 1 OFFSET 1 "
    
    //SELECT num FROM `表名`  ,  查询tian表中num
    //ORDER BY id DESC  , 按id倒序排序
    //LIMIT 1             查询一条
    //OFFSET 1            偏移量,就是跳过多少个
    

    相关文章

      网友评论

          本文标题:mysql:增,删,查,改

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