and or 并且 或者
like 模糊查询
in 批量操作
between and 在...之间
order by 排序
asc 升序(由小到大)
desc 降序(由大到小)
limit 限制记录条数
例子:
-- insert into tel (tname,tprice) values ('华为mate40pro','8999'),
-- ('华为mate30pro','2999'),('小米19pro','8999');
# MySQL中比较运算符 > < >= <= !=
#查询手机价格>100
select * from tel where tprice!=1000;
# mysql中的逻辑运算符 and 并且 or 或者
# and 表示两边的条件都成立才成立
select * from tel where tname='华为1' and tprice='6576765';
# or 或者 两边的条件有一个 成立 即可成立
select * from tel where tname='华为1' or tprice='6576765';
# between and 在...之间 包括边界
select * from tel where tid between 1 and 10;
# like 模糊查询 %表示通配符
-- 查询手机名称中包含华为的数据
select * from tel where tname like '%pro';
# in 批量 操作 批量查询 批量删除
#查询手机表 中tid是 5 6 7的数据
select * from tel where tid in(2,5,6,7);
-- --批量删除 删除tid等于5,6
delete from tel where tid in (5,6);
-- 批量修改
update tel set tname='华为20plus' where tid in (2,3,4);
-- order by排序 asc 升序(由小到大) desc 降序(由大到小)
select * from tel order by tprice desc;
# limit 限制记录条数 开始位置 长度 开始位置可以省
select * from tel limit 2,2;
分享php,MySQL相关知识点,希望能够帮助看到内容的您,博主喜欢美声,篮球,公路赛,越野...欢迎您的骚扰~~~