mysql 简单的 增 删 改 查
2018-08-07 本文已影响0人
Mattle
插入操作:
/**
** insert 操作:
** insert into 库名.表名 (###)values(###)
**/
insert into luna.tbl_admin (id, username, password, remark, create_time) values(1,"admin","123456","超级管理员", now());
删除操作:
/**
** 执行 delete 操作一定要加上 where 条件 要养成这个习惯
**/
delete from luna.tbl_admin where id = 1 and username = "admin";
更新操作:
/**
** 执行 update 操作一定要加上 where 条件 要养成这个习惯
**/
update luna.tbl_admin set username="admin", password = "123456789" where id = 1;
查询操作:
/**
** 执行 select 操作一定要加上 where 条件 要养成这个习惯
**/
select * from luna.tbl_admin where id = 1;
or
// select 字段名称 from 库名.表名 where 条件
select id, username, password, remark, create_time from luna.tbl_admin where id = 1;