当前位置:网站首页>Mysql--- query the top 5 students

Mysql--- query the top 5 students

2022-07-06 00:57:00 The evening wind blows


demand : The query result is top 5 Students of

After getting the demand , First analyze the requirements , Find out the screening conditions

One 、Mysql Inquire about

1、 The most basic query

select * from table where name="panpan"

2、 Check before 5 name
stay mysql Top of the filtered data in , You can use keywords :limit

select * from table where name="panpan" limit 1

explain : The name in the query table is panpan The first record

3、 Under what conditions , The demand is to screen by achievements , You can use order by Sort filter

select * from table where order by grade

Two 、 Query application

Query after merging :

select * from score order by grade limit 5

explain : Query to score Exterior and interior grade , With grade Screening , Before extraction 5 Bar record

原网站

版权声明
本文为[The evening wind blows]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060052156469.html