SQL Exercises: Who won the 1971 Nobel Prize for Literature?
13. Literature Winner 1971
From the following table, write a SQL query to find the Nobel Prize winner in ‘Literature’ for 1971. Return winner.
Sample table: nobel_win
YEAR SUBJECT WINNER COUNTRY CATEGORY ---- ------------------------- --------------------------------------------- ------------------------- ------------ 1970 Physics Hannes Alfven Sweden Scientist 1970 Physics Louis Neel France Scientist 1970 Chemistry Luis Federico Leloir France Scientist 1970 Physiology Ulf von Euler Sweden Scientist 1970 Physiology Bernard Katz Germany Scientist 1970 Literature Aleksandr Solzhenitsyn Russia Linguist 1970 Economics Paul Samuelson USA Economist 1970 Physiology Julius Axelrod USA Scientist ..... 1994 Literature Kenzaburo Oe Japan Linguist
Sample Solution:
-- This query selects the 'winner' column from the 'nobel_win' table.
SELECT winner
-- Specifies the table from which to retrieve the data (in this case, 'nobel_win').
FROM nobel_win
-- Filters the rows to only include those where the 'year' column has the value 1971
-- and the 'subject' column has the value 'Literature'.
WHERE year = 1971
AND subject = 'Literature';
Output of the Query:
winner Pablo Neruda
Code Explanation:
The above SQL query that selects the "winner" column from the 'nobel_win' table where the value of "year" column is 1971 and the value of "subject" column is 'Literature'. The WHERE clause is used to filter the rows and only return the rows that match the conditions specified in the WHERE clause. The "AND" operator is used to combine the two conditions.
Relational Algebra Expression:
Relational Algebra Tree:
Go to:
PREV : Nobel Winner of 1970.
NEXT : Locate Dennis Gabor.
Practice Online
For more Practice: Solve these Related Problems:
- Write a SQL query to find the Nobel Prize winner in "Physics" for 1971.
- Write a SQL query to retrieve the Nobel Prize winner in "Chemistry" for 1971.
- Write a SQL query to list the Nobel Prize winner in "Peace" for 1971.
- Write a SQL query to identify the Nobel Prize winner in "Economics" for 1971.
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
