Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6832871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:54:41+00:00 2026-05-26T22:54:41+00:00

Trying to solve some queries from sql zoo to practice sql skills I have

  • 0

Trying to solve some queries from sql zoo to practice sql skills

I have a table nobel with columns (year, subject, winner) which have information on the people who have earned noble prizes in a given year for a given subject.

So I assume the primary key to be composite of (year, subject, winner).

The problem I am trying to solve is: Show winners who have won more than one subject.

The output of the SQL query should have just one column with the winner names.

I feel that I should be using group by and using having(count(winner)) >1. But I think I need to group by by subject and that’s where my problem is.

I am not looking for a query. If you can provide me with more logic than query that would help. Also do not worry about the database it needs to be implemented on. I am just practicing these questions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:54:42+00:00Added an answer on May 26, 2026 at 10:54 pm

    This should give you people who won on multiple different subjects in any number of years:

    SELECT winner
    FROM nobel
    GROUP BY winner
    HAVING COUNT(DISTINCT subject) > 1
    

    For a specific year, just add WHERE year = <whatever> (or GROUP BY year for all years), though no person in history won a Nobel for two subjects in a single year – but who knows what future brings 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get a regexp to solve the next problem: I have some
I'm trying to speed up SELECT queries in MySQL tables which already have some
I'm stuck trying to solve this. I'm plotting some information that I have in
I'm trying to solve a problem where I have some classes in which I
I am currently trying to solve some problems from the USACO training website in
I was recently trying to solve some task in Python and I have found
I'm inheriting some code here from another developer and I'm trying to solve a
I'm trying to solve some Google Code Jam problems, where an input matrix is
Trying to solve a problem with templatetags. I have two templatetags: @register.inclusion_tag('directory/_alphabet.html') def alphabet_list(names):
In trying to solve the ajax back button problem I have found the Really

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.