SQL & Database Questions
- JOINs (INNER, LEFT, RIGHT, FULL OUTER, CROSS)
- GROUP BY with HAVING clauses
- Window functions (RANK, ROW_NUMBER, LAG, LEAD)
- Subqueries and CTEs
- Date/time manipulation
Q1.What is the difference between INNER JOIN, LEFT JOIN, and FULL OUTER JOIN?
SELECT u.name, COUNT(o.id) as order_count
FROM users u
LEFT JOIN orders o ON u.id = o.user_id
GROUP BY u.name
This shows all users including those who haven't ordered (order_count = 0).Q2.Write a SQL query to find the second-highest salary in an employees table.
SELECT MAX(salary) FROM employees
WHERE salary < (SELECT MAX(salary) FROM employees)
Approach 2 — Window function (more versatile):
SELECT salary FROM (
SELECT salary, DENSE_RANK() OVER (ORDER BY salary DESC) as rnk
FROM employees
) ranked
WHERE rnk = 2
Why DENSE_RANK over ROW_NUMBER?
• DENSE_RANK handles ties correctly — if two people share the top salary, it still identifies the next distinct value as rank 2
• ROW_NUMBER assigns arbitrary ordering to ties
• The window function approach generalizes to finding the Nth-highest salary by changing the rank filterStatistics & Analysis
Q3.Explain the difference between correlation and causation with a real-world example.
Q4.What is a p-value, and how would you explain it to a non-technical stakeholder?
Frequently Asked Questions
What tools should I know for a data analyst interview?
Core tools include SQL (PostgreSQL or BigQuery), Python or R for analysis, Excel/Google Sheets for quick exploration, and a visualization tool like Tableau, Power BI, or Looker. SQL proficiency is the single most important skill.
How do data analyst interviews differ from data scientist interviews?
Data analyst interviews focus more on SQL, business metrics, and data storytelling. Data scientist interviews emphasize machine learning, statistical modeling, and experimental design. Analyst roles are more about insights from existing data; scientist roles involve building predictive models.
How can AI tools help during a data analyst interview?
Tools like InterviewsUnlocked can provide personalized support — surfacing SQL syntax, statistical concepts, or analysis frameworks when you need a quick reference, so you can focus on communicating your thought process clearly.
Don't freeze in your next interview
InterviewsUnlocked gives you real-time AI coaching during live interviews — role-tailored answers, follow-up cues, and confidence when you need it most.
Related Resources
SQL Interview Questions: From Basics to Advanced Queries
Master SQL interviews with questions covering joins, window functions, CTEs, query optimization, and real-world data analysis problems with expert solutions.
Read moreSkills & TechnologiesPython Interview Questions & Answers for All Levels
Comprehensive Python interview prep covering core language features, OOP, data structures, concurrency, and real-world coding questions with expert answers.
Read moreInterview QuestionsTop Data Scientist Interview Questions & Answers
Prepare for data science interviews with expert questions on machine learning, statistics, Python, deep learning, and A/B testing with detailed model answers.
Read moreInterview TipsTechnical Interview Preparation: A 4-Week Plan
A structured 4-week technical interview preparation plan covering data structures, algorithms, system design, and mock interviews with daily schedules.
Read moreCompany InterviewsGoogle Interview Guide: Process, Questions & Tips
Complete Google interview guide covering the hiring process, common questions across engineering, PM, and analyst roles, and insider tips to stand out.
Read more