Using PostgreSQL to solve SQL coding questions on StrataScratch for training SQL technical.
# | Title | Difficulty | Company | Interview Date | Solution | Key Technical |
---|---|---|---|---|---|---|
10353 | Workers With The Highest Salaries | Medium | DoorDash | July 2021 | Link | join、max、dense_rank、subquery、case when |
10352 | Users By Average Session Time | Medium | Meta/Facebook | July 2021 | Link | date、min、max、avg、inner join、cte |
10322 | Finding User Purchases | Medium | Amazon | Dec 2020 | Link | inner join、between and |
10285 | Acceptance Rate By Date | Medium | Meta/Facebook | Nov 2020 | Link | count、cast、left join、cte |
10064 | Highest Energy Consumption | Medium | Meta/Facebook | Mar 2020 | Link | union all、sum、max、dense_rank、cte、subquery |
9915 | Highest Cost Orders | Medium | Amazon | May 2019 | Link | sum、max、between and、left join、subquery、cte |
10308 | Salaries Differences | Easy | Dropbox | Nov 2020 | Link | max、abs、filter、case when、inner join、cte |
10284 | Popularity Percentage | Hard | Meta/Facebook | Nov 2020 | Link | union、union all、count、sum、change data type use postfix、cte |
10319 | Monthly Percentage Difference | Hard | Amazon | Dec 2020 | Link | to_char、sum、lag、round、to_date、concat、left join、window、interval、cte |
10300 | Premium vs Freemium | Hard | Microsoft | Nov 2020 | Link | sum、inner join、filter、case when、cte |
514 | Marketing Campaign Success [Advanced] | Hard | Amazon | - | Link | count、having、rank、concat、in、min、cte |
10299 | Finding Updated Records | Easy | Microsoft | Nov 2020 | Link | max、inner join、cte |
10046 | Top 5 States With 5 Star Businesses | Hard | Yelp | Mar 2020 | Link | count、rank、subquery、cte |
9891 | Customer Details | Easy | Amazon | Apr 2019 | Link | left join |
9622 | Number Of Bathrooms And Bedrooms | Easy | Airbnb | Jan 2018 | Link | avg |
9632 | Host Popularity Rental Prices | Hard | Airbnb | Feb 2018 | Link | concat、case when、min、max、avg、cte |
10061 | Popularity of Hack | Easy | Meta/Facebook | Mar 2020 | Link | avg、inner join |
9782 | Customer Revenue In March | Medium | Meta/Facebook | July 2018 | Link | sum、to_char |
9917 | Average Salaries | Easy | Salesforce | May 2019 | Link | avg、left join、cte |
9726 | Classify Business Type | Medium | City of San Francisco | May 2018 | Link | lower、like、ilike、ilike any、array、case when |
9913 | Order Details | Easy | Amazon | May 2019 | Link | inner join、in |
10060 | Top Cool Votes | Medium | Yelp | Mar 2020 | Link | max、subquery |
10049 | Reviews of Categories | Medium | Yelp | Mar 2020 | Link | string_to_array、unnest、sum |
9897 | Highest Salary In Department | Medium | Apr 2019 | Link | max、inner join、in、cte | |
10087 | Find all posts which were reacted to with a heart | Easy | Meta/Facebook | - | Link | inner join |
9894 | Employee and Manager Salaries | Medium | Dropbox | Apr 2019 | Link | left join |
10156 | Number Of Units Per Nationality | Medium | Airbnb | - | Link | count、inner join、cte |
9728 | Number of violations | Medium | City of San Francisco | May 2018 | Link | to_char、extract、date_part、count |
9905 | Highest Target Under Manager | Medium | Salesforce | Apr 2019 | Link | dense_rank、max、subquery |
10176 | Bikes Last Used | Easy | Lyft | - | Link | max |
10026 | Find all wineries which produce wines by possessing aromas of plum, cherry, rose, or hazelnut | Medium | Wine Magazine | - | Link | posix regular expressions |
10159 | Ranking Most Active Guests | Medium | Airbnb | - | Link | sum、dense_rank、cte |
10182 | Number of Streets Per Zip Code | Medium | City of San Francisco | - | Link | left、lower、split_part、posix regular expressions、count、cte |
10077 | Income By Title and Gender | Medium | City of San Francisco | - | Link | sum、avg、inner join、cte |
9781 | Find the rate of processed tickets for each type | Medium | Meta/Facebook | - | Link | count、sum、cast、case when、cte |
9942 | Largest Olympics | Medium | ESPN | - | Link | count、dense_rank、cte |
9663 | Find the most profitable company in the financial sector of the entire world along with its continent | Easy | Forbes | - | Link | comparison operators、max |
9650 | Find the top 10 ranked songs in 2010 | Medium | Spotify | - | Link | comparison operators |
10128 | Count the number of movies that Abigail Breslin nominated for oscar | Easy | Netflix | - | Link | count |
9972 | Find the base pay for Police Captains | Easy | City of San Francisco | - | Link | ilike all、array、posix regular expressions |
9814 | Counting Instances in Text | Hard | - | Link | string_to_arrayunnest、count、to_tsvector、ts_stat、in、cte | |
9924 | Find libraries who haven't provided the email address in circulation year 2016 but their notice preference definition is set to email | Easy | City of San Francisco | - | Link | comparison operators |
9653 | Count the number of user events performed by MacBookPro users | Easy | Apple | - | Link | count |
10078 | Find matching hosts and guests in a way that they are both of the same gender and nationality | Medium | Airbnb | - | Link | concat、inner join、cte |
9992 | Find how many times each artist appeared on the Spotify ranking list | Easy | Spotify | - | Link | count |
9991 | Top Ranked Songs | Medium | Spotify | - | Link | count |
10003 | Lyft Driver Wages | Easy | Lyft | - | Link | comparison operators、logical operators |
10048 | Top Businesses With Most Reviews | Medium | Yelp | - | Link | dense_rank、subquery |
9680 | Most Profitable Companies | Medium | Forbes | - | Link | dense_rank、subquery |
9688 | Churro Activity Date | Easy | City of Los Angeles | - | Link | comparison operators |
9893 | Duplicate Orders | Medium | Apple | Apr 2019 | Link | count、having |
10324 | Distances Traveled | Medium | Lyft | Dec 2020 | Link | sum、rank、inner join、cte |
9896 | Customers Without Orders | Medium | Apple | Apr 2019 | Link | not in、left join where is null |
9921 | Department Salaries | Medium | Apple | May 2019 | Link | count、sum、filter、case when、inner join、cte |
9638 | Total Searches For Rooms | Medium | Airbnb | Feb 2018 | Link | count、sum、filter、case when |
9628 | Reviews Bins on Reviews Number | Medium | Airbnb | Feb 2018 | Link | case when |
10161 | Ranking Hosts By Beds | Medium | Airbnb | July 2020 | Link | sum、dense_rank |
9636 | Cheapest Neighborhoods With Real Beds And Internet | Medium | Airbnb | Feb 2018 | Link | rank、ilike、cte |
9901 | Super Managers | Medium | PayPal | Apr 2019 | Link | count、having、inner join、cte |
10068 | User Email Labels | Medium | Apr 2020 | Link | count、sum、case when、filter、inner join、change data type use postfix | |
9892 | Second Highest Salary | Medium | Amazon | Apr 2019 | Link | dense_rank、cte |
9912 | Lowest Priced Orders | Medium | Amazon | May 2019 | Link | min、inner join |
10351 | Activity Rank | Hard | July 2021 | Link | row_number、count | |
10303 | Top Percentile Fraud | Hard | Netflix | Nov 2020 | Link | ntile、percentile_cont |
9895 | Duplicate Emails | Medium | Salesforce | Apr 2019 | Link | count、having、cte |
9642 | Find the unique room types | Medium | Airbnb | Feb 2018 | Link | string_to_array、unnest、ltrim、regexp_split_to_table |
9904 | Highest Target | Medium | Salesforce | Apr 2019 | Link | max、subquery |
10044 | Highest Priced Wine In The US | Medium | Wine Magazine | Mar 2020 | Link | max、not in、cte |
9899 | Percentage Of Total Spend | Medium | Amazon | Apr 2019 | Link | sum() over(partition by)、change data type use postfix、inner join |
9898 | Distinct Salaries | Hard | Apr 2019 | Link | dense_rank、cte | |
10172 | Best Selling Item | Hard | Amazon | July 2020 | Link | extract、date_part、sum、dense_rank、cte |
10131 | Business Name Lengths | Hard | City of San Francisco | June 2020 | Link | regexp_replace、regexp_split_to_array、array_length |
2078 | From Microsoft to Google | Hard | Dec 2021 | Link | count、inner join、lead、ilike | |
10041 | Most Expensive And Cheapest Wine | Hard | Wine Magazine | Mar 2020 | Link | union all、dense_rank、max、cte |
9989 | Highest Paid City Employees | Hard | City of San Francisco | - | Link | row_number、max、cte |
2007 | Rank Variance Per Country | Hard | Meta/Facebook | Feb 2021 | Link | count、dense_rank、to_char、inner join、left join、cte |
2008 | The Cheapest Airline Connection | Hard | Delta Airlines | Jan 2021 | Link | left join、inner join、union all、dense_rank、min、cte |
2012 | Viewers Turned Streamers | Hard | Twitch | Jan 2021 | Link | dense_rank、count、in、cte |
2028 | New And Existing Users | Hard | Microsoft | Mar 2021 | Link | extract、count、min、inner join、cte |
10019 | Find the probability of rides for each weather and the hour | Hard | Lyft | Feb 2020 | Link | count、arithmetic operators、change data type use postfix、cte |
10171 | Find the genre of the person with the most number of oscar winnings | Hard | Netflix | - | Link | count、max、inner join |
2044 | Most Senior & Junior Employee | Hard | Uber | June 2021 | Link | count、min、max、arithmetic operators、cte |
2029 | The Most Popular Client_Id Among Users Using Video and Voice Calls | Hard | Microsoft | Mar 2021 | Link | count、in、avg、arithmetic operators、case when、dense_rank、change data type use postfix 、cte |
10043 | Median Price Of Wines | Hard | Wine Magazine | Mar 2020 | Link | percentile_cont、union all、cte |
9821 | Common Friends Friend | Hard | Feb 2019 | Link | union、inner join、count、cte | |
9952 | Name to Medal Connection | Hard | ESPN | - | Link | split_part、length、count、filter |
9919 | Unique Highest Salary | Hard | Salesforce | May 2019 | Link | max |
9900 | Median Salary | Hard | Apr 2019 | Link | percentile_cont | |
9918 | Arizona, California, and Hawaii Employees | Hard | Amazon | May 2019 | Link | row_number、full join、cte |