Home » SQL & PL/SQL » SQL & PL/SQL » Select in select
Select in select [message #13928] Tue, 03 August 2004 02:34 Go to next message
lokraj
Messages: 1
Registered: August 2004
Junior Member
I have a Problem

Question

Some countries have populations more than three times that of any of their nieghbours (in the same region). Give the countries and regions.

Table

Cai (name, region, area, population, gdp)

My script is

select name from cia x
where population >= 3(select min population from cia y
where x.region=y.region)

ERROR: parser: parse error at or near "(" at character 48

Please help me.
Re: Select in select [message #13931 is a reply to message #13928] Tue, 03 August 2004 04:28 Go to previous messageGo to next message
kim
Messages: 116
Registered: December 2001
Senior Member
select name
from cia x
where exists(select 1
from cia y
where x.region = y.region
and x.population >= 3 * y.population)
Re: Select in select [message #390345 is a reply to message #13928] Fri, 06 March 2009 01:14 Go to previous messageGo to next message
alakya
Messages: 3
Registered: March 2009
Junior Member
i have problem while i am execiting this query
table bbc
(name region population)

Some countries have populations more than three times that of any of their neighbours ... in the same region list the countire

select name,region from bbc x where exists( select name from bbc y
where x.region = y.region and x.population >= 3*y.population);
Re: Select in select [message #390352 is a reply to message #13931] Fri, 06 March 2009 01:26 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
@kim,
More than 100 posts and you still don't know how to post...

Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags.
Use the "Preview Message" button to verify.


Regards
Michel
Re: Select in select [message #390353 is a reply to message #390345] Fri, 06 March 2009 01:27 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Is this a question, or did you provide an alternative solution?
Re: Select in select [message #390354 is a reply to message #390352] Fri, 06 March 2009 01:28 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Michel Cadot wrote on Fri, 06 March 2009 08:26
@kim,
More than 100 posts and you still don't know how to post...

Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags.
Use the "Preview Message" button to verify.


Regards
Michel


Michel,

Over 20000 posts, and still unable to spot the posting date

(just kidding, I couldn't help it)
Re: Select in select [message #390356 is a reply to message #390354] Fri, 06 March 2009 01:32 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Laughing Got me!
Re: Select in select [message #390358 is a reply to message #13928] Fri, 06 March 2009 01:40 Go to previous messageGo to next message
alakya
Messages: 3
Registered: March 2009
Junior Member

hi question is
:Some countries have populations more than three times that of any of their neighbours (in the same region). Give the countries and regions.

Table bbc
(Name Region Population)

SELECT NAME,
region
FROM bbc x
WHERE EXISTS (SELECT NAME
FROM bbc y
WHERE x.region = y.region
AND x.population >= 3 * y.population);

can any one helpme....
Re: Select in select [message #390359 is a reply to message #390358] Fri, 06 March 2009 01:42 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
What is YOUR question? (Not your teacher's)
Re: Select in select [message #390360 is a reply to message #390359] Fri, 06 March 2009 01:50 Go to previous messageGo to next message
alakya
Messages: 3
Registered: March 2009
Junior Member
I have problem " invalid character" while i am executing
Re: Select in select [message #390361 is a reply to message #390360] Fri, 06 March 2009 01:55 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Where?

Copy-paste the execution & response from sqlplus here.
Use [code] and [/code]-tags around your code to make it readable when posting it.
Previous Topic: CLOB insert problem
Next Topic: which one is faster
Goto Forum:
  


Current Time: Sun Dec 04 22:48:48 CST 2016

Total time taken to generate the page: 0.05554 seconds