mysql - Whats wrong with my nested subquery? -
so i'm solving interactive tutorial http://www.sqlzoo.net/wiki/select_from_nobel_tutorial bonus part doesn't have solution.
here's question: in years physics prize awarded no chemistry prize.
select yr nobel subject = 'physics' , yr not in (select yr nobel subject = 'literature')
i got output
1943 1935 1918 1914
when tutorial said answer is
1933 1924 1919 1917
i don't understand why solution wrong
edit: saw careless mistake 'literature' should 'chemistry' still seems invalid
there 2 errors in query:
- you mistyped
chemistry
(your query saysliterature
instead) - you did not ask
distinct
results
here modified query:
select distinct yr nobel subject = 'physics' , yr not in (select yr nobel subject = 'chemistry')
distinct
important, because in 1933 physics prize has been awarded multiple winners - namely, dirac , schrödinger. these 2 rows table result in 2 entries 1933 in output, not want.
Comments
Post a Comment