SQL Exercises: Details of the Prime Ministerial winners after 1972
SQL Basic Select Statement: Exercise-17 with Solution.
Write a SQL query to display all details of the Prime Ministerial winners after 1972 of Menachem Begin and Yitzhak Rabin.
Sample table: nobel_win
Sample Solution:
SELECT * FROM nobel_win
WHERE year >1972
AND winner IN ('Menachem Begin',
'Yitzhak Rabin');
Output of the Query:
year subject winner country category 1978 Peace Menachem Begin Israel Prime Minister 1994 Peace Yitzhak Rabin Israel Prime Minister
Code Explanation:
The above SQL query retrieves all columns from the 'nobel_win' table where the year of the award is greater than 1972 and the winner's name is either "Menachem Begin" or "Yitzhak Rabin". The query will return all rows that match these criteria, resulting in a list of all Nobel Prizes awarded after 1972 to either Menachem Begin or Yitzhak Rabin. The IN operator allows to check if a value is within a set of values, in this case the query will filter for rows where the winner column is either Menachem Begin or Yitzhak Rabin
Relational Algebra Expression:
Relational Algebra Tree:
Practice Online
Query Visualization:
Duration:

Rows:

Cost:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous Python Exercise: Details of Chemistry prize winners from 1965 to 1975.
Next Python Exercise: Show all the details of the winners with the first name Louis.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
SQL: Tips of the Day
What is the best way to paginate results in SQL Server?
SELECT * FROM ( SELECT ROW_NUMBER() OVER ( ORDER BY OrderDate ) AS RowNum, * FROM Orders WHERE OrderDate >= '1980-01-01' ) AS RowConstrainedResult WHERE RowNum >= 1 AND RowNum < 20 ORDER BY RowNum
Database: SQL Server
Ref: https://bit.ly/3MGrNlk
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- JavaScript functions Exercises
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises
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