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


Please Help Members By Posting Answers For Below Questions

What is not equal in sql?

519


How to add, remove, modify users using sql?

576


What does count (*) mean in sql?

1106


What are secondary keys?

571


what is the difference between myisam static and myisam dynamic? : Sql dba

592






Mention what are different methods to trace the pl/sql code?

570


How do you delete data from a table?

552


What is a design view?

530


What are local and global variables and their differences?

598


what is union? : Sql dba

590


What is the difference between distinct and unique in sql?

480


What are the sql aggregate functions?

614


What is the reports view in oracle sql developer?

553


What are different sql data types?

525


Is primary key an index?

545