0

我必须制作一个篮球运动员表和一个查询,以找到我尝试过的最有经验的球员

SELECT firstName, lastName, MAX(experience) FROM Player

但我假设那是错误的。

所以基本上我想找经验最高的玩家(数据类型设置为INT)

谢谢!!:D

4

7 回答 7

4
SELECT  firstName, 
        lastName, 
        experience
FROM    Player
WHERE   experience = (SELECT MAX(experience) FROM Player)
于 2013-04-30T08:50:39.343 回答
1
select top 1 firstName, lastName, experience
from Player
order by experience desc;
于 2013-04-30T10:34:35.773 回答
1
SELECT  * FROM Player
WHERE experience = 
(SELECT max(experience) FROM Player)
于 2013-04-30T08:54:03.160 回答
0

正确的查询是:

Select FirstName, LastName, Experience as Experience_Player
from Player
where experience = (Select MAX(experience) from Player)

假设您有以下数据:

FirstName                     LastName               Experience  
Adam                          Smit                   15  
John                          Carlos                 25  
Ibrahim                       Khan                   10  

当您应用上述查询时,您将得到 Ibrahim Khan 的名字,因为他是最有经验的玩家。

如果你想让多名玩家拥有超过 10 年的经验,只需运行此查询

Select FirstName, LastName, experience 
from Players
where experience > 10
于 2013-04-30T10:25:32.467 回答
0
SELECT FIRSTNAME,LASTNAME,EXPERIENCE FROM (SELECT FIRSTNAME,LASTNAME,EXPERIENCE,DENSE_RANK() OVER (ORDER BY EXPERIENCE DESC) EXP FROM PLAYER) WHERE EXP=1;
于 2014-10-11T16:11:49.403 回答
0
select firstName, lastName, experience
from Player
where rownum = 1
order by experience desc;
于 2013-04-30T08:54:22.720 回答
-2
select * from (
  select firstname, lastName, experience from player
  order by experience desc)
where rownum = 1
于 2013-04-30T08:51:02.487 回答