Question 1 |
||||||||
Table T1 | Table T2 | |||||||
Column A | Column B | ColumnB | Code | |||||
1 | 4 | 4 | XYZ | |||||
2 | 5 | 5 | ABC | |||||
3 | 6 | |||||||
1>What will be Output if we use inner join between T1 and T2 | ||||||||
2>What will be Output if we use Left outer join between T1 and T2 | ||||||||
3>What will be Output if we use Right outer join between T1 and T2 | ||||||||
Question 2 | ||||||||
1.Write a Query for below requirement | ||||||||
Table A | Lookup Table B | |||||||
Column A | Column B | ColumnF | Code | |||||
1 | 1 | F | XYZ | |||||
2 | Null | Null | -99 | |||||
3 | -1 | |||||||
-1 | 22 | |||||||
1.Retrive Code value by doing a lookup between Table A.Column B=Table B.ColumnF | ||||||||
Coditions | ||||||||
If Column A>0 then retrive code value from Table B | ||||||||
If Column A>0 and Column B is Null then do null value transformation | ||||||||
If Column A>0 and Column B=-1 then convert -1 to Null and do the Null value transformation | ||||||||
If Column A<0 as="" blank="" code="" td="" the="" then="" update="" value=""> | 0> | |||||||
So Output should be | ||||||||
Column A | Column B | Code | ||||||
1 | 1 | XYZ | ||||||
2 | Null | -99 | ||||||
3 | -1 | -99 | ||||||
-1 | 22 | Null | ||||||
Question 3 | ||||||||
1 . Write a query to retrive data exists before '@' in email id.It should work dynamicaly for all the email ids. | ||||||||
2. Remove all the specical characters and number from the email id column dynamicaly. | ||||||||
Examples | ||||||||
Email Id | Expected result after transformation | |||||||
abcd@gmail.com | abcd | |||||||
abcdefgh@facebook.com | abcdefgh | |||||||
abcd12@yahoo.co.in | abcd12 | |||||||
Question 4 Write a Query for below requirement | ||
Table T1 | ||
Column A | Column B | Column C |
XYZ | ABC | T1 |
XYZ | ABC | T2 |
ABC | XYZ | T3 |
Table A2 | Table A3 | |||
Column D | Column E | Column F | Column G | |
T1 | S1 | S1 | XYZ | |
T1 | S2 | S1 | Null | |
T2 | S3 | S1 | -1 | |
T3 | S4 | S2 | ABC | |
S3 | DWF | |||
1. Eliminate the duplicate records from Table A1 based on columns A and B | |||||
2. Then do a Lookup Between Table A1 and Table A2 on TableA1.Column C=Table A2.column D | |||||
3. If more than one values found in Table A2 for the same record in Column E then conider only latest record | |||||
4. Do a Lookup between Table A2 and Table A3 on A2.Column E=A3.Column F to retrieve column G from Table A3 | |||||
5. If any 'Null' and '-1' values exists in Column G of Table A3 then don’t consider those records |
Output should be | ||
Column A | Column B | Column G |
ABC | XYZ | XYZ |
Question 5 | ||
What will be the out put if you do Union and Union all betwee Table A and Table B | ||
Table A | Table B | |
36 | 36 | |
36 | 36 | |
36 | 36 | |
36 | 36 | |
36 | 36 | |
36 | 36 |