0% found this document useful (0 votes)
13 views

SQL Queries Interview Questions - Oracle Part 3

Uploaded by

RaJu Bhai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

SQL Queries Interview Questions - Oracle Part 3

Uploaded by

RaJu Bhai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

11/29/2018 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

1. Write a query to generate sequence numbers from 1 to the specified number N?


Unix Sed Command to Delete Lines in File - 15 Examples

Solution: String Functions in Hive

Top Examples of Awk Command in Unix

SELECT LEVEL FROM DUAL CONNECT BY LEVEL<=&N; Sed Command in Unix and Linux Examples

Design/Implement/Create SCD Type 2 Effective Date


Mapping in Informatica
2. Write a query to display only friday dates from Jan, 2000 to till now?
Date Functions in Hive
Solution:
SQL Queries Interview Questions - Oracle Part 1

Top Unix Interview Questions - Part 1


SELECT C_DATE,
Update Strategy Transformation in Informatica
TO_CHAR(C_DATE,'DY')
FROM
(
Have Questions? Follow Me
SELECT TO_DATE('01-JAN-2000','DD-MON-YYYY')+LEVEL-1 C_DATE
FROM DUAL
CONNECT BY LEVEL <=
(SYSDATE - TO_DATE('01-JAN-2000','DD-MON-YYYY')+1)
)
WHERE TO_CHAR(C_DATE,'DY') = 'FRI';

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

994 have me in circles View all

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

( SELECT LEVEL L FROM DUAL


CONNECT BY LEVEL <= (SELECT MAX(REPEAT) FROM T)
) A
WHERE T.REPEAT >= A.L
ORDER BY T.PRODUCTS;

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:

SQL Queries Interview Questions - Oracle Part 1


SQL Queries Interview Questions - Oracle Part 2
SQL Queries Interview Questions - Oracle Part 3
SQL Queries Interview Questions - Oracle Part 4
SQL Queries Interview Questions - Oracle Part 5

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

Enter your comment...

Comment as: Google Accoun

Publish Preview

Newer Post Home Older Post


Subscribe to: Post Comments (Atom)

https://www.folkstalk.com/2011/10/oracle-scenario-based-questions-with.html 5/5

You might also like