SQL Queries Interview Questions - Oracle Part 3
SQL Queries Interview Questions - Oracle Part 3
Home Data Warehouse Informatica Informatica Scenarios Informatica Cloud Oracle Unix Hadoop
Search... Search
SQL Queries Interview Questions - Oracle Part 3
Here I am providing Oracle SQL Query Interview Questions. If you find any bugs in the queries,
Popular Posts
Please do comment. So, that i will rectify them. Informatica Scenario Based Interview Questions with
Answers - Part 1
SELECT LEVEL FROM DUAL CONNECT BY LEVEL<=&N; Sed Command in Unix and Linux Examples
https://www.folkstalk.com/2011/10/oracle-scenario-based-questions-with.html 1/5
11/29/2018 SQL Queries Interview Questions - Oracle Part 3
vijay bhaskar
3. Write a query to duplicate each row based on the value in the repeat column? The input table Add to circles
data looks like as below
Products, Repeat
----------------
A, 3
B, 5
C, 2
Now in the output data, the product A should be repeated 3 times, B should be repeated 5 times
and C should be repeated 2 times. The output will look like as below
Products, Repeat
----------------
A, 3
A, 3
A, 3
B, 5
B, 5
B, 5
B, 5
B, 5
C, 2
C, 2
Solution:
SELECT PRODUCTS,
REPEAT
FROM T,
https://www.folkstalk.com/2011/10/oracle-scenario-based-questions-with.html 2/5
11/29/2018 SQL Queries Interview Questions - Oracle Part 3
4. Write a query to display each letter of the word "SMILE" in a separate row?
S
M
I
L
E
Solution:
SELECT SUBSTR('SMILE',LEVEL,1) A
FROM DUAL
CONNECT BY LEVEL <=LENGTH('SMILE');
5. Convert the string "SMILE" to Ascii values? The output should look like as 83,77,73,76,69.
Where 83 is the ascii value of S and so on.
The ASCII function will give ascii value for only one character. If you pass a string to the ascii
function, it will give the ascii value of first letter in the string. Here i am providing two solutions to
get the ascii values of string.
Solution1:
SELECT SUBSTR(DUMP('SMILE'),15)
FROM DUAL;
https://www.folkstalk.com/2011/10/oracle-scenario-based-questions-with.html 3/5
11/29/2018 SQL Queries Interview Questions - Oracle Part 3
Solution2:
SELECT WM_CONCAT(A)
FROM
(
SELECT ASCII(SUBSTR('SMILE',LEVEL,1)) A
FROM DUAL
CONNECT BY LEVEL <=LENGTH('SMILE')
);
Recommended Posts:
If you like this post, then please share it on Google by clicking on the +1 button.
No comments:
Post a Comment
https://www.folkstalk.com/2011/10/oracle-scenario-based-questions-with.html 4/5
11/29/2018 SQL Queries Interview Questions - Oracle Part 3
Publish Preview
https://www.folkstalk.com/2011/10/oracle-scenario-based-questions-with.html 5/5