w3resource

SQL Exercises: Display the year and subject of Dennis Gabor prize

SQL Basic Select Statement: Exercise-14 with Solution.

From the following table, write a SQL query to locate the Nobel Prize winner ‘Dennis Gabor'. Return year, subject.

Sample table: nobel_win

 

Sample Solution:

SELECT year, subject
  FROM nobel_win
 WHERE winner = 'Dennis Gabor';

Output of the Query:

year	subject
1971	Physics

Code Explanation:

The above query in SQL that retrieves data from a table called 'nobel_win'. The query selects the year and subject columns from the table and filters the results by only displaying rows where the winner column is equal to 'Dennis Gabor'. The query is asking the database to select the year and subject of the nobel prize win for the winner named 'Dennis Gabor'.

Relational Algebra Expression:

Relational Algebra Expression: Display the year and subject that won 'Dennis Gabor' his prize.

Relational Algebra Tree:

Relational Algebra Tree: Display the year and subject that won 'Dennis Gabor' his prize.

Practice Online


Query Visualization:

Duration:

Query visualization of Display the year and subject that won 'Dennis Gabor' his prize - Duration

Rows:

Query visualization of Display the year and subject that won 'Dennis Gabor' his prize - Rows

Cost:

Query visualization of Display the year and subject that won 'Dennis Gabor' his prize - Cost

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

Previous SQL Exercise: Who won the 1971 Nobel Prize for Literature?.
Next SQL Exercise: Names of Physics winners since 1950.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.

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

 





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