TGViewer
Data Analytics Data Analytics @sqlspecialist ยท 111K subscribers
Post #2469 9.75K
Data Analyst Interview Questions with Answers: Part-2 ๐Ÿง 

11. What is a subquery?
A subquery is a query nested inside another SQL query (like SELECT, INSERT, UPDATE, DELETE). It returns data used by the outer query.
Example:
SELECT name FROM students WHERE marks > (SELECT AVG(marks) FROM students);

12. Explain GROUP BY and HAVING clause
โ€ข GROUP BY: Groups rows by a column's values for aggregation (SUM(), COUNT(), etc.)
โ€ข HAVING: Filters aggregated results (like WHERE for groups)
Example:
SELECT department, COUNT(*) FROM employees GROUP BY department HAVING COUNT(*) > 5;

13. What are window functions in SQL?
Window functions perform calculations across a set of rows related to the current row without collapsing rows.
Example: ROW_NUMBER(), RANK(), LEAD(), LAG()
SELECT name, department, RANK() OVER(PARTITION BY department ORDER BY salary DESC) FROM employees;

14. Difference between RANK(), DENSE_RANK(), ROW_NUMBER()
โ€ข ROW_NUMBER(): Unique rank even if values are the same
โ€ข RANK(): Skips ranks for ties
โ€ข DENSE_RANK(): No rank gaps for ties
Example: If two people tie at 2nd place:
โ€ข RANK: 1, 2, 2, 4
โ€ข DENSE_RANK: 1, 2, 2, 3
โ€ข ROW_NUMBER: 1, 2, 3, 4

15. What is a CTE in SQL?
CTE (Common Table Expression) is a temporary result set defined with WITH for better readability and reuse in a query.
Example:
WITH HighEarners AS (
SELECT name, salary FROM employees WHERE salary > 100000
)
SELECT * FROM HighEarners;

16. What is the difference between WHERE and HAVING?
โ€ข WHERE: Filters before grouping (on individual rows)
โ€ข HAVING: Filters after grouping (on aggregates)
Example:
SELECT department, COUNT(*) FROM employees
WHERE active = 1
GROUP BY department
HAVING COUNT(*) > 10;

17. Explain data types in SQL
Data types define the kind of data a column can store:
โ€ข INT, FLOAT โ€“ Numeric
โ€ข VARCHAR, TEXT โ€“ Strings
โ€ข DATE, DATETIME โ€“ Time values
โ€ข BOOLEAN โ€“ True/False values

18. How do you handle NULL values in SQL?
โ€ข Use IS NULL or IS NOT NULL
โ€ข Use functions like COALESCE() to replace NULLs
Example:
SELECT COALESCE(phone, 'Not Provided') FROM customers;

19. What are common data visualization tools?
โ€ข Power BI
โ€ข Tableau
โ€ข Google Data Studio
โ€ข Excel
โ€ข Python libraries: Matplotlib, Seaborn, Plotly

20. When would you use a bar chart vs pie chart?
โ€ข Bar chart: Compare multiple categories clearly
โ€ข Pie chart: Show proportions of a whole (best for 2โ€“5 categories)
Bar charts are generally more accurate and readable.

๐Ÿ’ฌ Double Tap โ™ฅ๏ธ For Part-3
  • โค 20
  • ๐Ÿ‘ 2
  • ๐Ÿ”ฅ 2
  • ๐Ÿ‘Ž 1
More from @sqlspecialist
  1. Oct 12, 2026๐Ÿš€ ๐—ช๐—ต๐—ถ๐—ฐ๐—ต ๐—ง๐—ฒ๐—ฐ๐—ต ๐—ฆ๐—ธ๐—ถ๐—น๐—น ๐—ช๐—ถ๐—น๐—น ๐—ฌ๐—ผ๐˜‚ ๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ ๐—ถ๐—ป ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ? Want to builโ€ฆ
  2. Oct 9, 2026โ€œHere, the data is sorted by the second column in descending order and the first five rowsโ€ฆ
  3. Oct 9, 2026๐Ÿ“Š Data Analyst Interview Series โ€” Part 6 Guys, let's continue our Data Analyst Interviewโ€ฆ
  4. Oct 9, 2026๐Ÿ‡ฎ๐Ÿ‡ณ ๐—š๐—ข๐—ฉ๐—˜๐—ฅ๐—ก๐— ๐—˜๐—ก๐—ง ๐—ข๐—™ ๐—œ๐—ก๐——๐—œ๐—” โ€” ๐—”๐—œ๐—–๐—ง๐—˜ ๐—œ๐—ก๐—ง๐—˜๐—ฅ๐—ก๐—ฆ๐—›๐—œ๐—ฃ๐—ฆ ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ ๐Ÿš€โ€ฆ
  5. Oct 8, 2026๐ŸŽ“ ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ผ๐—ณ๐˜ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐˜„๐—ถ๐˜๐—ต ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ฒ๐˜€! ๐Ÿš€๐Ÿ”ฅ Upgrโ€ฆ
  6. Oct 7, 2026๐Ÿ“Š Kandinsky 6.0 Video: AI-Powered Content Creation for Analysts The new Kandinsky 6.0 Vidโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’