使用where 过滤数据
时间:2019-09-23 20:45:55
收藏:0
阅读:115
--本章只要内容是MySQL中使用where搜索条件进行过滤数据。
where条件在from子句后面给出,如下所示:
select name,price from shops
where price<30;
这条语句从商品shops表中查询价格小于30的商品名称以及详细价格。
--where子句的位置,在同时使用order by 子句时,应该让order by 位于where之后,否则就会产生错误。
例如:
select id,name,price from shops
where price <500
order by desc;
这条语句从商品表中查询价格小于500的商品,并且通过降序的排序方式进行排序。
原文:https://www.cnblogs.com/ludundun/p/11574226.html
评论(0)