ba6.us - Dave's Database Related Stuff

  • home
  • blog
  • notebooks
  • projects
  • recent
  • about
  • manifesto
  • !
Home › Blogs › dmann's blog

Tag Cloud

apex Application Express Auditing data dbi development export funnies HTML Java linux monitoring oem oracle performance perl rman scripting sql SQL Developer sqlplus tuning unix windows
more tags

Search

RSS Feed

Blog Posts :

Navigation

  • Feed aggregator

User login

  • Request new password

Oracle IN Condition and Multi Column Subqueries

dmann — Fri, 02/19/2010 - 15:02

I keep coming across a construct in some legacy SQL that has been causing all kinds of performance issues for us. I guess you could call it using the IN condition with multi-column subqueries. I located the syntax for the IN condition here but it doesn't really get into much detail about using this construct. Here is an example of the subquery (it returns the lowest salary and department_id for each department): And here is how it is incorporated into the main query (returns all employees with the lowest salary in each department): If you are wondering what happens behind the scenes, I found a reference in the Oracle documentation to how Oracle may handle optimizing a construct like this in the How the CBO Merges an IN Subquery section of the Tuning Guide. So there you have it, a (old) new way to use the IN operator! -Dave Keywords: IN Condition , IN Operator
  • oracle
  • sql
  • dmann's blog

I feel so much hapepir now I

Peerless (not verified) — Wed, 08/17/2011 - 12:36

I feel so much hapepir now I understand all this. Thanks!

  • reply

Nice example... thanks

arief (not verified) — Mon, 12/12/2011 - 06:06

Nice example... thanks

  • reply

Post new comment

The content of this field is kept private and will not be shown publicly.
Input format
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
2 + 10 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.


Cornify
  • home
  • blog
  • notebooks
  • projects
  • recent
  • about
  • manifesto
  • !

Content Copyright 2006-2010. Links are copyright of respective owners.