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 trigger means?

559


What are database links used for?

587


What is the advantage of index in sql?

532


What is recursive stored procedure?

591


What is the primary key?

531






What is the difference between jpql and sql?

546


How do you rename a table in sql?

526


What is pl sql script?

558


Why should I use postgresql?

557


what are the differences among rownum, rank and dense_rank? : Sql dba

534


Explain exception handling in pl/sql?

524


What is union and union all keyword in sql and what are their differences?

568


what is try_catch block in procedure

1185


What is %s in sql?

558


What does the file extension accdb stand for?

544