0% found this document useful (0 votes)
292 views3 pages

Pre Interview Assignment Data Analyst - Albanero

The document provides an SQL interview assignment with 5 questions. Question 1 asks to write a query to find missing IDs between the minimum and maximum IDs in a table. Question 2 asks to retrieve departments with less than 2 employees. Question 3 asks to retrieve employee positions and total salaries for each. Question 4 asks to find the 3rd highest salary without TOP/limit. Question 5 asks to find the median salary for each company without built-in functions. Tables are provided for employee info and positions to answer questions 2-4.

Uploaded by

emmamurphy1416
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)
292 views3 pages

Pre Interview Assignment Data Analyst - Albanero

The document provides an SQL interview assignment with 5 questions. Question 1 asks to write a query to find missing IDs between the minimum and maximum IDs in a table. Question 2 asks to retrieve departments with less than 2 employees. Question 3 asks to retrieve employee positions and total salaries for each. Question 4 asks to find the 3rd highest salary without TOP/limit. Question 5 asks to find the median salary for each company without built-in functions. Tables are provided for employee info and positions to answer questions 2-4.

Uploaded by

emmamurphy1416
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/ 3

ALBANERO Data Analyst PRE INTERVIEW ASSIGNMENT

(Type the query and attach the screenshot of output)

P1: Write an SQL query to find missing ids from a database


The missing ID’s are the ID’s that that fall in range of minimum and maximum of ids currently
present in the database
The ID’s cannot be more than 2 digits

ID Name

24 ABCD

27 DEFG

31 HIJKL

Expected output:

Missing ID

25

26

28

29

30

Please go through the following tables for answering the next 3 questions(P2- P4):

Employee Info Table:


EmpID EmpFname EmpLname Department Project Address DOB Gender
1 Sanjay Mehra HR P1 Hyderabad(HYD) 01/12/1976 M
2 Ananya Mishra Admin P2 Delhi(DEL) 02/05/1968 F
3 Rohan Diwan Account P3 Mumbai(BOM) 01/01/1980 M
4 Sonia Kulkarni HR P1 Hyderabad(HYD) 02/05/1992 F
5 Ankit Kapoor Admin P2 Delhi(DEL) 03/07/1994 M
Employee Position Table:
EmpID EmpPosition DateOfJoining Salary
1 Manager 01/05/2022 500000
2 Executive 02/05/2022 75000
3 Manager 01/05/2022 90000
2 Lead 02/05/2022 85000
1 Executive 01/05/2022 300000

P2: Write a query to retrieve Departments who have less than 2 employees working in it.
P3: Write a query to retrieve EmpPostion along with total salaries paid for each of them.
P4: Write a query to find the 3rd highest salary from the Employee Position table without using
TOP/limit keyword.

P5: Write a SQL query to find the median salary of each company without using any built-in
SQL functions
Id Company Salary
1 A 2341
2 A 341
3 A 15
4 A 15314
5 A 451
6 A 513
7 B 15
8 B 13
9 B 1154
10 B 1345
11 B 1221
12 B 234
13 C 2345
14 C 2645
15 C 2645
16 C 2652
17 C 65
Expected Output:

Id Company Salary
5 A 451
6 A 513
12 B 234
9 B 1154
14 C 2645

You might also like