- select * from products where id in(select id from cats where name like '%java%');//查找类型中名字中包含java的的商品信息
- order by 字段名字 desc /asc
- select * from products order by price desc;//按照降序排列
- limit
- select * from products order by price limit 1;//取出价格便宜的商品
- select * from products where id < 14 limit 0, 1 //id为14的上一条
-
mysql> select * from products where id > 3 order by price desc limit 0, 1;
+----+-----+------+-------+----------------+-----+
| id | cid | name | price | desn | num |
+----+-----+------+-------+----------------+-----+
| 5 | 5 | java | 8.18 | this is a java | 3 |
+----+-----+------+-------+----------------+-----+ - count()
- max()
- avg()
- min()
- sum()
- group by
- having