PostgreSQL 풀이 | Top Three Salaries
·
SQL
문제 1.  Top Three SalariesAs part of an ongoing analysis of salary distribution within the company, your manager has requested a report identifying high earners in each department. A 'high earner' within a department is defined as an employee with a salary ranking among the top three salaries within that department.You're tasked with identifying these high earners across all departments. Write a ..
PostgreSQL 풀이 | Active User Retention
·
SQL
문제 1.  Active User RetentionAssume you're given a table containing information on Facebook user actions. Write a query to obtain number of monthly active users (MAUs) in July 2022, including the month in numerical format "1, 2, 3".Hint:An active user is defined as a user who has performed actions such as 'sign-in', 'like', or 'comment' in both the current month and the previous month.https://dat..
PostgreSQL 풀이 | Teams Power Users
·
SQL
문제 1.  Teams Power UsersWrite a query to identify the top 2 Power Users who sent the highest number of messages on Microsoft Teams in August 2022. Display the IDs of these 2 users along with the total number of messages they sent. Output the results in descending order based on the count of the messages.Assumption:No two users have sent the same number of messages in August 2022. https://datalem..
PostgreSQL 풀이 | Highest-Grossing Items
·
SQL
문제 1.  Highest-Grossing ItemsAssume you're given a table containing data on Amazon customers and their spending on products in different category, write a query to identify the top two highest-grossing products within each category in the year 2022. The output should include the category, product, and total spend.https://datalemur.com/questions/sql-highest-grossing Amazon SQL Interview Question ..
PostgreSQL 풀이 | Histogram of Tweets
·
SQL
문제 1.  Histogram of TweetsAssume you're given a table Twitter tweet data, write a query to obtain a histogram of tweets posted per user in 2022. Output the tweet count per user as the bucket and the number of Twitter users who fall into that bucket.In other words, group the users by the number of tweets they posted in 2022 and count the number of users in each group.https://datalemur.com/questio..
PostgreSQL 풀이 | Data Science Skills
·
SQL
문제 1.  Data Science SkillsGiven a table of candidates and their skills, you're tasked with finding the candidates best suited for an open Data Science job. You want to find candidates who are proficient in Python, Tableau, and PostgreSQL.Write a query to list the candidates who possess all of the required skills for the job. Sort the output by candidate ID in ascending order.https://datalemur.co..
PostgreSQL 풀이 | Unfinished Parts
·
SQL
문제 1.  Unfinished PartsTesla is investigating production bottlenecks and they need your help to extract the relevant data. Write a query to determine which parts have begun the assembly process but are not yet finished.Assumptions:parts_assembly table contains all parts currently in production, each at varying stages of the assembly process.An unfinished part is one that lacks a finish_date.This..
PostgreSQL 풀이 | Laptop vs. Mobile Viewership (CASE문과 집계함수, FILTER)
·
SQL
문제 1.  Laptop vs. Mobile ViewershipAssume you're given the table on user viewership categorised by device type where the three types are laptop, tablet, and phone.Write a query that calculates the total viewership for laptops and mobile devices where mobile is defined as the sum of tablet and phone viewership. Output the total viewership for laptops as laptop_reviews and the total viewership for..
PostgreSQL 풀이 | Average Post Hiatus (Part 1) (연도 추출, 날짜 차이)
·
SQL
문제 1.  Average Post Hiatus (Part 1)Given a table of Facebook posts, for each user who posted at least twice in 2021, write a query to find the number of days between each user’s first post of the year and last post of the year in the year 2021. Output the user and number of the days between each user's first and last post.https://datalemur.com/questions/sql-average-post-hiatus-1 Average Post Hia..
PostgreSQL 풀이 | Sending vs. Opening Snaps (FILTER, ON, USING)
·
SQL
문제 1.  Sending vs. Opening SnapsAssume you're given tables with information on Snapchat users, including their ages and time spent sending and opening snaps.Write a query to obtain a breakdown of the time spent sending vs. opening snaps as a percentage of total time spent on these activities grouped by age group. Round the percentage to 2 decimal places in the output.Notes:Calculate the followin..