数据库
首页 > 数据库> > mysql 常用语法

mysql 常用语法

作者:互联网

SHOW TABLES;
USE blog;
-- ctrl+shift+r 删除注释
-- ctrl+shift+c 注释
-- 添加 内容 insert into 表()values()
-- insert into users(us,ps,realname)values('lisi','123456','lisi')
-- 查询 select * from 表
-- select * from users;-- 
-- select*from users where us="lisi" and ps="223"
-- like 查询包含
-- select*from users where ps like '%2%' 

-- 排序  ORDER BY id  默认正序  ORDER BY id desc; 倒叙
-- select*from users where ps like '%2%' order by id;
-- SELECT*FROM users WHERE ps LIKE '%2%' ORDER BY id desc;

-- 更新
-- update users set realname='lisi2' where us='lisi'

-- 删除
-- delete from users where us='lisi'

-- state 1 存在  state=0 则为删除



-- update users set state='0' where us='lisi' ; -- 软删除
-- 查询<> '0' 不等于0

SELECT * FROM users WHERE state <>'0'

Sqylog 中使用

标签:ps,常用,users,--,语法,lisi,mysql,where,select
来源: https://www.cnblogs.com/lvlisn/p/15929604.html