我必须制作一个篮球运动员表和一个查询,以找到我尝试过的最有经验的球员
SELECT firstName, lastName, MAX(experience) FROM Player
但我假设那是错误的。
所以基本上我想找经验最高的玩家(数据类型设置为INT)
谢谢!!:D
SELECT firstName,
lastName,
experience
FROM Player
WHERE experience = (SELECT MAX(experience) FROM Player)
select top 1 firstName, lastName, experience
from Player
order by experience desc;
SELECT * FROM Player
WHERE experience =
(SELECT max(experience) FROM Player)
正确的查询是:
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
SELECT FIRSTNAME,LASTNAME,EXPERIENCE FROM (SELECT FIRSTNAME,LASTNAME,EXPERIENCE,DENSE_RANK() OVER (ORDER BY EXPERIENCE DESC) EXP FROM PLAYER) WHERE EXP=1;
select firstName, lastName, experience
from Player
where rownum = 1
order by experience desc;
select * from (
select firstname, lastName, experience from player
order by experience desc)
where rownum = 1