Can you solve this sql query?

Say i have 4 tables

each table have two common attribute say name of city and population

I want to retrieve name of city with minimum population

can you find it?

Replies

  • blak
    blak
    select city_name,min(population) pop
    from
    (
    select city_name, population from table1
    union
    select city_name, population from table2
    union
    select city_name, population from table3
    union
    select city_name, population from table4
    )
    group by city_name
    order by pop;
  • ISHAN TOPRE
    ISHAN TOPRE
    select city_name,
    from table1, table2, table3, table4,
    where population<= P1, P2, P3, P4.

You are reading an archived discussion.

Related Posts

Person’s name, travel dates and destination are input. The database (really an array or two) is checked and if the space is available, the person is added to the database...
Rockmelt has been in the stealth mode for quite long time. The browser has been now released for public download. Get your copy of Rockmelt from here: RockMelt - Your...
Gmail has introduced a new feature called Bulk, Forums, Notifications. If you enable these smart labels, Gmail will automatically try to figure out the nature of the message sent and...
Those who aren't aware of the difference between wordpress.com and wordpress.org, the former is the hosted platform and the later is the downloadable CMS that you can host on any...
The world celebrates Women's Day. I'm wondering why not have a Men's Day? Any opinions?