sql - best time to SELECT value in Oracle nested query -


From the optimization perspective, I want to know when SELECT is best for some honorary data data is . Specifically, I have this query:

Where do I place this part?

  SELECT 'string 1' from the double union with the 'double string' from the 'string 2' AS segment FROM dual union all selected 'string 3' H2> In the external question  

I need access to the Segment column in my external SELECT and looks like I SELECT when it is needed, i.e.

  SELECT ..., segment, case when segment = 'string 1' and then ... end ... by ('string1' Select Twenty Unions From all Select 'String 2' AS Segment Dual Unions with 'String 3' from AAS Segment (SELECT ... FROM ... GROUP BY ...) WHERE ...  

Verses InInstant Query

However, it is better than Select my arbitrary string in the most simple question :

  SELECT. .., segment, case when segment = 'string 1' then ... end (... SELECT ..., SELECT 'STRIN 1' AS SELECT two selections from SELECT ..., Segment FROM ('SELECT' 'SESSION 2' SUS SEGMENT Dul union all Do not 'String 3' dual to AS segment) ... ... by group ..., Segment) ... ...  

Since the use of the data in the outer query is inaccessible The query (via WHERE ), it seems that choosing the stars in the easiest question might be better, because the data is preceded first SELECT What is the Best Practice Guideline About When?

Edit: ("Rows of six rows (one column for line spindle):"), I was able to remove it:

 < All the 'String 2' AS Segments, with the double section of 'SELECT' string 1 'AS Segment, instead, I do: 

  SELECT ROWNUM rowno to connect the duL by LEVEL & lt; = From Dual Unit, from Dual Union to all 'String 3' from AAS Segment,  

3

and then in my external query, I When: rowno = 1 then 'string1' when rowno = 2 'string2' when queue = 3 then string '3' ads segment

However, it still does not answer my question where to put inline footage for SELECT ing rowno : the most endless or external query?

As I have understood, if you do not use rownum in your mother Nner query, then It does not matter where you want to place it as an optimizer, then you can use it only in the best way. With this you are left to decide which version is more readable for you.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -