Welcome to my SQL Practice Repository! This repository contains my solutions to real-world SQL interview questions from top tech companies. I use these challenges to sharpen my data manipulation, aggregation, and analytical skills.
I have solved data scenarios based on business cases from:
- Airbnb: Pricing strategies and host earnings analysis.
- Amazon (Prime Video): Content engagement and viewership tracking.
- LinkedIn: User engagement scoring and content type performance.
- Meta: Ad performance, custom audiences, and cost per conversion.
- Microsoft (Teams): Data security, file sharing, and risk identification.
- Stripe: Loan repayment success rates and business revenue variability.
In these scripts, I have applied advanced SQL techniques to solve complex business logic, including:
- CTEs (Common Table Expressions): Structuring complex multi-step queries for readability.
- Window Functions: Using
PERCENT_RANK() OVER()for percentile calculations. - Conditional Aggregation: Utilizing
SUM(CASE WHEN ...)andAVG(CASE WHEN ...)for pivoting and targeted metrics. - String Manipulation: Applying
SPLIT_PART()and concatenations (||) to clean and extract text data. - Date & Time Filtering: Using
EXTRACT(),BETWEEN, and date logic to analyze time-series data. - Complex Joins & Aggregations: Joining Fact and Dimension tables (
fct_anddim_) to generate meaningful business insights.
The SQL files are organized by company name. Inside each file, you will find the business question as a comment, followed by the optimized SQL query.
Disclaimer: All questions are sourced from interviewmaster.ai. Solutions are written by me as part of my continuous learning journey.