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 104525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:17:43+00:00 2026-05-11T01:17:43+00:00

Alright, this one (3a; sample problem with provided answer) has got me scratching my

  • 0

Alright, this one (3a; sample problem with provided answer) has got me scratching my head:

bbc(name, region, area, population, gdp)
3a. Find the largest country in each region:

SELECT region, name, population   FROM bbc x  WHERE population >= ALL     (SELECT population        FROM bbc y       WHERE y.region = x.region         AND population > 0) 

I understand the concept of ‘WHERE y.region = x.region‘ when I think about it in terms of the db engine looping over the table entries and matching each x.region with the current y.region (in the nested SELECT)… but wtf does ‘AND population > 0‘ do? It isn’t a right answer without it, but I don’t see how not…

  • 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. 2026-05-11T01:17:44+00:00Added an answer on May 11, 2026 at 1:17 am

    That clause is there just because there is an entry in the Europe table (for the Vatican) which has NULL in the population column. The following works also and I believe is more understandable:

    SELECT region, name, population   FROM bbc x  WHERE population >= ALL     (SELECT population        FROM bbc y       WHERE y.region = x.region         AND population IS NOT NULL) 

    In the MySQL documentation for ALL subqueries, there’s a helpful comment (emphasis theirs):

    In general, tables containing NULL values and empty tables are ‘edge cases.’ When writing subquery code, always consider whether you have taken those two possibilities into account.

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

Sidebar

Ask A Question

Stats

  • Questions 97k
  • Answers 97k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer "I could use C#'s abbreviated properties but then each little… May 11, 2026 at 7:24 pm
  • Editorial Team
    Editorial Team added an answer The referrer is set by the browser. You cannot change… May 11, 2026 at 7:24 pm
  • Editorial Team
    Editorial Team added an answer I think the description attribute may be what you are… May 11, 2026 at 7:24 pm

Related Questions

Alright. So I wanted to use a file written in c in c++. I
Alright I have an xml document that looks something like this: <xml> <list> <partner>
Alright so I have this C++ image capturing class. I was wondering if I
Alright, I'll preface this with the fact that I'm a GTK and Python newb,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.