5. SQL_Noted
5. SQL_Noted
3. think aloud and try to communicate with the interviewer for clarification.
4. explain your thought process and tell why you do this way
a. Sum + Count
b. Max + Min
SQL Cheat Sheet — SQL Reference Guide for Data Analysis – Dataquest
a. syntax error
b. efficiency
Interviewer is not your enemy.
Example 1:
Write an SQL query that reports the first login date for each player.
1. clarify
login date, and event date are the same? Yes
do you care about same player with different device login? N0
—++++player_id+++++first_log_date++++
event_date is in DATE format
2. script
SELECT player_id, event_date
FROM Activity
Order By event_date
Example 2: . Use the same Activity table, write a SQL query that
reports the device that is first logged in for each player.
Use the same Activity table, write a SQL query that reports the device that is first logged
in for each player.
Example 3:
Write an SQL query that reports the products that were only sold in spring 2019.
Example 4:
Write an SQL query that reports the most experienced employees in each project. In
case of a tie, report all employees with the maximum number of experience years.
Example 5:
You are implementing a page recommendation system for a social media website. Your
system will recommended a page to user_id if the page is liked by at least one friend of
user_id and is not liked by user_id.
Write an SQL query to find all the possible page recommendations for every user. Each
recommendation should appear as a row in the result table with these columns: