---
# System prepended metadata

title: Interview Arek

---

# Interview Arek


**Table employees**

| EmpId | FullName | ManagerId | DateOfJoining | City |
|-------|--------------|-----------|---------------|------------|
| 121 | John Snow | 321 | 01/31/2014 | Toronto |
| 321 | Walter White | 986 | 01/30/2015 | California |
| 421 | Kuldeep Rana | 876 | 27/11/2016 | New Delhi |
| | | | | |

**Table salaries**
| EmpId | Project | Salary |
|-------|---------|--------|
| 121   | P1      | 8000   |
| 321   | P2      | 10000  |
| 421   | P1      | 12000  |
|       |         |        |



1. Write an SQL query to fetch project-wise count of employees.

select project, count(1) empNum from salaries group by project

2. Write an SQL query to list names of all employes with salary higher than 9000

select e.fullName, s.salary
from salaries s
join employees e on s.empId = e.empId
// where s.salary > 9000



**Table fun fund**
| EmpId | FunFundBudget |
|-------|---------------|
| 121   | 100           |
| 321   | 200           |
| 421   | 250           |
|       |               |

## Ex

Given a set of time intervals in any order, merge all overlapping intervals into one and output the result which should have only mutually exclusive intervals. Let the intervals be represented as pairs of integers for simplicity. 

For example, let the given set of intervals be {{1,3}, {5,7}, {2,4}, {6,8}}. The intervals {1,3} and {2,4} overlap with each other, so they should be merged and become {1, 4}. Similarly, {5, 7} and {6, 8} should be merged and become {5, 8}

Input:

[[1, 5], [4, 7], [9, 10], [3, 4], [11, 14]]



[[1,7], [9, 11], [6,10]]
Output:

[[1, 7], [9, 10], [11,14]]

```
input= [[1, 5], [4, 7], [9, 10], [3, 4], [11, 14]]
tmp
for i in input:
    for j in input2 

```