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.

Answers were Sorted based on User's Feedback



Write the sql query using dual table for below output? 1 L R --- --- ---- 1 1 1 1 2 ..

Answer / abilash reddy

SELECT 1, L, R FROM (SELECT LEVEL R FROM DUAL CONNECT BY LEVEL<=3), (SELECT LEVEL L FROM DUAL CONNECT BY LEVEL<=3);

Is This Answer Correct ?    14 Yes 0 No

Write the sql query using dual table for below output? 1 L R --- --- ---- 1 1 1 1 2 ..

Answer / 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

Write the sql query using dual table for below output? 1 L R --- --- ---- 1 1 1 1 2 ..

Answer / mani

WITH a as (SELECT level L from DUAL CONNECT BY level <=3)
SELECT 1, L, R
FROM (SELECT level R from DUAL CONNECT BY level <=3) b
CROSS JOIN a;

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

What are the advantages of pl sql over sql?

0 Answers  


What is meant by Join? What are the different types of Joins available? Explain.

5 Answers   Cap Gemini,


Explain normalization and what are the advantages of it?

0 Answers  


Where not exists in sql?

0 Answers  


What are the data types allowed in a table?

3 Answers  






Which one is faster ienumerable or iqueryable?

0 Answers  


What does joining a thread mean?

0 Answers  


what is bcp? When does it used? : Sql dba

0 Answers  


What is loop in pl sql?

0 Answers  


What is anonymous block in sql?

0 Answers  


How do you write a subquery?

0 Answers  


What is pl sql code?

0 Answers  


Categories