Table Structure:
nobel(yr, subject, winner)
Name the winner(s) of the Nobel prize in Chemistry in 2001. Sort their names alphabetically.
Question 2
Tables Example:
|
|
How many medals did each country win in this database? (Make sure to list countries by their name and not their ID.)
fix 1st comment #2 with:
ReplyDeleteselect country.name, (select count(*) from ttms where ttms.id = country.id) as meds order by meds desc
also fix #1
ReplyDeleteselect winner form nobel where subject = "Chemistry" and yr = 2001 order by winner
No idea.
ReplyDeleteQuestion 1:
ReplyDeleteSelect yr-2001, winner
From nobel
Where winner In (‘Chemistry’)
Question 2:
Korea won 2 medals
1) SELECT * FROM nobel ORDER BY winner
ReplyDelete2) SELECT country.name , count(*) FROM ttms ORDER BY count(*) DESC
Eddy Huber
ReplyDeleteQuestion 1:
SELECT * FROM nobel
WHERE subject = 'Chemistry'
AND yr = '2001'
order by winner asc
Question 2:
no clue
1) SELECT winner FROM nobel
ReplyDeleteWHERE yr = 2001 AND subject = 'Chemistry'
order by winner
2) still working...
select winner from nobel where yr=2001 where subject=chemistry order by winner
ReplyDeleteselect yr, subject, winner
ReplyDeletefrom nobel
where yr=2001 and subject='chemistry'
order by winner desc
yr subject winner
2001 Chemistry William S. Knowles
2001 Chemistry Ryoji Noyori
2001 Chemistry K. Barry Sharpless
SELECT country.name , count(*) FROM ttms JOIN country ON (ttms.country=country.id) GROUP BY country.name ORDER BY count(*) DESC
ReplyDeleteSELECT country.name, count(*) FROM ttms
ReplyDeleteJOIN country ON (ttms.country = country.id
)
GROUP BY country.name