SQL Test Answers
SQL Test Answers
1) Write a query to return all employees still working for the company with last names starting with "Smith" sorted by last name then first n
2) Given the `Employee` and `AnnualReviews` tables, write a query to return all employees who have never had a review sorte
3) Write a query to calculate the difference (in days) between the most and least tenured employee still working for the compa
4) Given the employee table above, write a query to calculate the longest period (in days) that the company has gone without a
5) Write a query that returns each employee and for each row/employee include the greatest number of employees that worked
AnnualReviews
ID EmpID ReviewDate
10 1 2016-01-01
20 2 2016-04-12
30 10 2015-02-13
40 22 2010-10-12
50 11 2009-01-01
60 12 2009-03-03
70 13 2008-12-01
80 1 2003-04-12
g with "Smith" sorted by last name then first name. 90 1 2014-04-30
DAU 9851
2) Facebook DAU
date_ user_count
2019-02-25 2609
2019-02-26 2540
2019-02-27 2607
2019-02-28 2408
2019-03-01 2613
2019-03-02 2685
2019-03-03 2700
DAU 2595
3) Distribution by hours
hour_ traffic_count traffic_percentage
4 260 0.37%
5 437 0.62%
6 644 0.92%
7 1642 2.35%
8 3206 4.58%
9 4095 5.85%
10 4313 6.16%
11 4038 5.77%
12 3757 5.37%
13 3728 5.33%
14 4446 6.35%
15 4613 6.59%
16 4183 5.98%
17 3565 5.09%
18 3618 5.17%
19 4349 6.21%
20 5514 7.88%
21 5128 7.33%
22 3775 5.39%
23 2207 3.15%