mysql:增,删,查,改

增:

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:增,删,查,改)