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

How to add new employee details in an employee_details table with the following details

649


what is table? : Sql dba

572


How to select the Nth maximum salary from Table Emp in Oracle SQL Plus ?

603


Is left join inner or outer?

589


What is sql and how does it work?

551






What are the advantages of sql? Explain

650


How to use boolean type in select statement?

583


What is package in pl sql?

579


What does truncate mean in sql?

536


What is the difference between a primary key and a unique key?

558


what are numeric data types? : Sql dba

580


What is execute immediate?

549


What is oracle sql developer?

605


What is the difference between explicit and implicit cursors in oracle?

516


What is a ddl command?

536