Write the sql query using dual table for below output?
1 L R
--- --- ----
1 1 1
1 2 1
1 3 1
1 1 2
1 2 2
1 3 2
1 1 3
1 2 3
1 3 3
Write a query using only Dual table with out writing any pl/sql program.
Answer Posted / shailesh
select 1 as "1", decode(mod(level,3), 0, 3, mod(level,3))as l,
case
when level<=3 then 1
when level>3 and level <7 then 2
else
3
end as r
from dual connect by level<10;
Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
How do you explain an index number?
Is sql a backend language?
Can you load data into multiple tables at once? : aql loader
Mention what does plvtab enables you to do when you showthe contents of pl/sql tables?
What are analytic functions in sql?
How do you update sql?
How do I partition a table in sql?
How will you distinguish a global variable with a local variable in pl/sql?
Can a varchar be a primary key?
What is the use of nvl function?
What is ttitle and btitle?
what is the difference between char_length and length? : Sql dba
What is the use of %rowtype?
What are the rules to be applied to nulls whilst doing comparisons?
How do I truncate a word?