﻿ SQL - Who won the 1971 Nobel Prize for Literature?

# SQL Exercises: Who won the 1971 Nobel Prize for Literature?

## SQL Basic Select Statement: Exercise-13 with Solution.

From the following table, write a SQL query to find the Nobel Prize winner in ‘Literature’ for 1971. Return winner.

Sample table: nobel_win

Sample Solution:

``````SELECT winner
FROM nobel_win
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:

## Query Visualization:

Duration:

Rows:

Cost:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous SQL Exercise: Display the Nobel prizes for 1970.
Next SQL Exercise: Display the year and subject of Dennis Gabor prize.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.

﻿

## SQL: Tips of the Day

A table name as a variable -

For static queries, like the one in your question, table names and column names need to be static.

For dynamic queries, you should generate the full SQL dynamically, and use sp_executesql to execute it.

Static query:

```SELECT * FROM [DB_ONE].[dbo].[ACTY]
EXCEPT
SELECT * FROM [DB_TWO].[dbo].[ACTY]
```

Ref: https://bit.ly/3sFxxnk

We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook