SQL interview questions

stratascratch에서 제공하는 freemium SQL 인터뷰 문제 25개를 풀고 답을 정리 했습니다.
문제를 풀어보면 난이도 선정 기준이 다소 모호하다는 생각이 들긴 하지만 전반적으로 intermediate 수준의 SQL을 테스트 해보기 괜찮은 문제들입니다.
데이터베이스로 PostgreSQL을 사용하기 때문에 PostgreSQL 문법을 사용하였습니다.


Salaries Differences (10308, Dropbox)
Finding Updated Records (10299, Microsoft)
Popularity of Hack (10061, Facebook)
Top 5 States With 5 Star Businesses (10046, Yelp)
Average Salaries (9917, Salesforce)
Customer Details (9891, Amazon)
Number Of Bathrooms And Bedrooms (9622, Airbnb)


Top Search Results (10288, Facebook)
Acceptance Rate By Date (10285, Facebook)
Top Cool Votes (10060, Yelp)
Highest Energy Consumption (10064, Facebook)
Reviews of Categories (10049, Yelp)
Order Details (9913, Amazon)
Highest Number Of Orders (9909, Amazon)
Highest Target Under Manager (9905, Salesforce)
Employee and Manager Salaries (9894, Dropbox)
Customer Revenue In March (9782, Facebook)
Inspections That Resulted In Violations (9728, City of San Francisco)
Classify Business Type (9726, Medium)


Premium vs Freemium (10300, Microsoft)
Popularity Percentage (10284, Facebook)
Highest Cost Orders (9915, Amazon)
Highest Salary In Department (9897, Twitter)
Host Popularity Rental Prices (9632, Airbnb)
Marketing Campaign Success [Advanced] (514, Amazon)