TGViewer
Data Analytics Data Analytics @sqlspecialist · 111K subscribers
Post #3162 3.77K
📊 Data Analyst Interview Series — Part 2

Guys, let's continue our Data Analyst Interview Series.

In Part 2, let's move into some important SQL and data-related interview questions that are frequently tested in Data Analyst interviews. 👇

1️⃣ What is SQL and why is it important for a Data Analyst?

Sample Answer:

"SQL stands for Structured Query Language. It is used to interact with relational databases. As a Data Analyst, I use SQL to retrieve, filter, join, aggregate, and analyze data. It is important because a large amount of business data is stored in databases, and SQL allows analysts to efficiently extract the data required for analysis."

2️⃣ What is the difference between WHERE and HAVING?

Sample Answer:

"WHERE filters individual rows before aggregation, whereas HAVING filters groups after aggregation.

For example, if I want to find customers whose total sales exceed ₹1 lakh, I would use HAVING because the condition is applied to an aggregated result."

SELECT Customer_ID, SUM(Sales) AS Total_Sales
FROM Sales
GROUP BY Customer_ID
HAVING SUM(Sales) > 100000;


3️⃣ What is the difference between INNER JOIN and LEFT JOIN?

Sample Answer:

"An INNER JOIN returns only the records that have matching values in both tables.

A LEFT JOIN returns all records from the left table and the matching records from the right table. If there is no match, the columns from the right table contain NULL."

For example, if I want all customers, including customers who haven't placed any orders, I would use a LEFT JOIN.

4️⃣ What is a primary key?

Sample Answer:

"A primary key is a column or combination of columns that uniquely identifies each record in a table. It must contain unique values and cannot contain NULL values.

For example, Customer_ID can be a primary key in a Customer table if every customer has a unique ID."

5️⃣ What is a foreign key?

Sample Answer:

"A foreign key is a column that references a primary key or another unique key in another table. It establishes a relationship between tables.

For example, Customer_ID in an Orders table can reference Customer_ID in the Customers table."

6️⃣ What is the difference between UNION and UNION ALL?

Sample Answer:

"Both are used to combine the results of two or more SELECT statements.

UNION removes duplicate records from the combined result, while UNION ALL retains duplicates.

Because UNION performs duplicate elimination, UNION ALL can generally be faster when duplicate removal isn't required."

7️⃣ What is a NULL value in SQL?

Sample Answer:

"NULL represents a missing, unknown, or unavailable value. It is different from zero, an empty string, or a blank value.

We should use IS NULL or IS NOT NULL to check for NULL values rather than using an equals operator."

SELECT *
FROM Customers
WHERE Email IS NULL;


8️⃣ What is GROUP BY used for?

Sample Answer:

"GROUP BY is used to group rows that have the same values in one or more columns so that aggregate functions can be applied to each group.

For example, to calculate total sales by region:"

SELECT Region, SUM(Sales) AS Total_Sales
FROM Sales
GROUP BY Region;


9️⃣ What are aggregate functions in SQL?

Sample Answer:

"Aggregate functions perform calculations on multiple rows and return a single result for each group.

Common aggregate functions include:"

• COUNT() — counts records

• SUM() — calculates the total

• AVG() — calculates the average

• MIN() — finds the minimum value

• MAX() — finds the maximum value

For example:

SELECT
COUNT(*) AS Total_Orders,
SUM(Sales) AS Total_Sales,
AVG(Sales) AS Average_Sales
FROM Sales;
  • ❤ 4
More from @sqlspecialist
  1. Oct 4, 20269️⃣ How would you calculate month-over-month growth? Sample Answer: “I would first retriev…
  2. Oct 4, 2026📊 Data Analyst Interview Series — Part 3 Guys, let's continue our Data Analyst Interview…
  3. Sep 29, 2026🔟 How would you find duplicate records in SQL? Sample Answer: "I would first identify the…
  4. Sep 29, 2026𝗙𝗥𝗘𝗘 𝗥𝗲𝘀𝗼𝘂𝗿𝗰𝗲𝘀 𝗧𝗼 𝗟𝗲𝗮𝗿𝗻 𝗔𝗜 𝗶𝗻 𝟮𝟬𝟮𝟲🚀 ​ Explore 6 free resource…
  5. Sep 29, 2026"After identifying duplicates, I investigate whether they are genuine duplicate records or…
  6. Sep 29, 2026📊 Data Analyst Interview Series — Part 1 Guys, let's start a Data Analyst Interview Serie…
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 →