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 can we make an if statement within a select statement?
Why select is used in sql?
How many types of cursors are available in pl/sql?
Who developed sql?
What is a composite primary key?
What is clause?
What is the importance of sqlcode and sqlerrm?
Is sql between inclusive?
how to include character strings in sql statements? : Sql dba
i have some prob lem to tell me about my self in interview first round ...
What is the best free sql database?
What is on delete restrict?
What are the advantages of indexing?
What are the types of variable use in pl sql?
The in operator may be used if you know the exact value you want to return for at least one of the columns.