美文网首页
mysql 简单的 增 删 改 查

mysql 简单的 增 删 改 查

作者: Mattle | 来源:发表于2018-08-07 13:24 被阅读0次

插入操作:

/**
 ** 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; 

相关文章

网友评论

      本文标题:mysql 简单的 增 删 改 查

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