- Database: tennis
- table: matches
- columns: matchno(pk), won, lost …etc
Problem:
Get the match number and the sets won and lost in each match where num of sets won is >= num of sets lost multiplied by 2.
Wrong query:
use tennis;
select matchno, lost * 2 AS spl
from matches
where won >= spl
What is wrong in this query? How can it be modified to get the right output?
Correct query:
select matchno, won, lost
from matches
where won >= lost * 2
1 Answer