Data Analytics – Telegram
Data Analytics
108K subscribers
126 photos
2 files
791 links
Perfect channel to learn Data Analytics

Learn SQL, Python, Alteryx, Tableau, Power BI and many more

For Promotions: @coderfun @love_data
Download Telegram
Data Analytics
🎯 Top 20 SQL Interview Questions You Must Know SQL is one of the most in-demand skills for Data Analysts. Here are 20 SQL interview questions that frequently appear in job interviews. 📌 Basic SQL Questions 1️⃣ What is the difference between INNER JOIN…
SQL Interview Questions with detailed answers:

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

INNER JOIN: It returns only the rows where there is a match between both tables.

Example:

SELECT * FROM employees INNER JOIN departments ON employees.department_id = departments.department_id; 

This will only return rows where an employee has a department.

LEFT JOIN: It returns all the rows from the left table, along with matching rows from the right table. If there is no match, NULL values will be returned for the right table.

Example:

SELECT * FROM employees LEFT JOIN departments ON employees.department_id = departments.department_id; 


This will return all employees, even if they don't belong to any department (NULL will be returned for department-related columns).

Like this post if you want me to continue posting all the answers 👍♥️

Share with credits: https://news.1rj.ru/str/sqlspecialist

Hope it helps :)
18👍18
SQL Interview Questions with detailed answers:

2️⃣ How does GROUP BY work, and why do we use it?

GROUP BY is used to arrange identical data into groups, often for performing aggregation functions (like COUNT, SUM, AVG, etc.) on each group. It's typically used with aggregate functions to summarize data.

Example:
Consider a sales table:

SELECT department_id, SUM(salary) AS total_salary FROM employees GROUP BY department_id; 


Explanation:
GROUP BY department_id: This groups all rows in the employees table by their department.
SUM(salary): This calculates the total salary for each department.

The result will show the department_id along with the corresponding total salary.

Why use GROUP BY?
It allows you to analyze data at different levels of granularity (e.g., department, region) by summarizing data in a meaningful way.

Like this post if you want me to continue this SQL Interview Series♥️

Share with credits: https://news.1rj.ru/str/sqlspecialist

Hope it helps :)
👍2211
🧠 Case Study: How to Analyze a Business Problem Like a Pro

🚀 Want to solve real-world business problems? Here's how to approach it!

Data analysis isn’t just about writing queries or generating charts—it’s about solving business problems that drive key decisions.

Here’s a step-by-step guide to help you analyze business problems effectively:

📌 Step 1: Understand the Business Problem

First, understand the context. Speak with the stakeholders or team to clarify:

What is the business goal?

What data do you need to solve the problem?

What actions or decisions will the analysis lead to?


🔍 Example: A retail company wants to increase sales in a particular region. Your job is to identify the key factors affecting sales and come up with recommendations.

📌 Step 2: Gather the Right Data

After understanding the problem, ensure you have access to reliable data. This could include:

Sales data (transactions, customers, regions)

Marketing data (advertising campaigns, promotions)

External factors (economic conditions, competition)


🧠 Tip: Ensure data is clean and complete before analysis to avoid skewed results.

📌 Step 3: Analyze the Data

Now, dive into the data and perform the following tasks:

1. Data Exploration: Look for patterns, trends, and anomalies.


2. Hypothesis Testing: Identify possible causes of the problem (e.g., "Are promotions leading to an increase in sales?").


3. Segmentation Analysis: Break down the data by regions, products, customer types, etc. to identify key insights.



🧠 Example:
Use SQL to extract sales data by region and calculate monthly growth:

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


📌 Step 4: Visualize the Insights

Once you've analyzed the data, create visualizations to make the insights clear and actionable:

💹 Use line charts for trends over time.

📊 Use bar charts to compare different segments (regions, products, etc.).

🗺 Use heatmaps for geographical analysis.


💡 Tip: Keep your visualizations simple and focused on the key insights.


📌 Step 5: Provide Recommendations

Finally, based on your analysis, provide actionable recommendations to the business.

For example: “Focus promotions on Region X, where sales are consistently lower than other regions.”

“Increase marketing spend for the high-performing products.”

Free Resources for business analysts
👇👇

https://news.1rj.ru/str/analystcommunity

Share with credits: https://news.1rj.ru/str/sqlspecialist

Hope it helps :)
👍179
Data Analytics
SQL Interview Questions with detailed answers: 2️⃣ How does GROUP BY work, and why do we use it? GROUP BY is used to arrange identical data into groups, often for performing aggregation functions (like COUNT, SUM, AVG, etc.) on each group. It's typically…
SQL Interview Questions with detailed answers:

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

WHERE: It is used to filter records before any grouping occurs. It operates on individual rows in the table.

HAVING: It is used to filter records after the grouping operation. It works on aggregated data (e.g., data created using GROUP BY).

Example:

-- Using WHERE to filter rows before grouping 
SELECT department_id, AVG(salary) AS avg_salary FROM employees WHERE salary > 50000 GROUP BY department_id;

-- Using HAVING to filter groups after aggregation
SELECT department_id, AVG(salary) AS avg_salary FROM employees GROUP BY department_id HAVING AVG(salary) > 60000;


Explanation:

WHERE filters rows where the salary is greater than 50,000 before grouping by department.
HAVING filters departments where the average salary is greater than 60,000 after grouping.

Key difference:
WHERE filters individual rows.
HAVING filters groups after aggregation.

Like this post if you want me to continue this SQL Interview Series♥️

Share with credits: https://news.1rj.ru/str/sqlspecialist

Hope it helps :)
👍1610
Which of the following is not a Python Library?
Anonymous Quiz
5%
Pandas
2%
Numpy
6%
Matplotlib
87%
Tableau
👍121👏1
Which of the following is SQL Command is used to sort results?
Anonymous Quiz
34%
SORT BY
57%
ORDER BY
7%
SORTED
3%
ORDER ON
👍181
Data Analytics
Which of the following is SQL Command is used to sort results?
Guys, please check out my SQL tutorial if you're getting this wrong! 👇
https://news.1rj.ru/str/sqlspecialist/567

For the next few days, I'll be posting basic data analytics questions to ensure all my subscribers understand the essential concepts. Once I see 80%+ correct answers, we'll move on to more advanced polls and quizzes!

Hope you all succeed one day :)
👍179
Data Analytics
SQL Interview Questions with detailed answers: 3️⃣ What is the difference between HAVING and WHERE? WHERE: It is used to filter records before any grouping occurs. It operates on individual rows in the table. HAVING: It is used to filter records after…
SQL Interview Questions with detailed answers:

4️⃣ How do you remove duplicate rows from a table?

To remove duplicate rows, you can use the DISTINCT keyword in a SELECT query.

Example:

SELECT DISTINCT column_name FROM table_name; 


Explanation:
DISTINCT will return only unique rows for the specified column(s). It compares all columns in the query and removes duplicates.

For example, if you have a table of employees and some rows are repeated, using DISTINCT will only return unique employees.

Example with multiple columns:

SELECT DISTINCT first_name, last_name FROM employees; 


This will return only unique combinations of first and last names.

Top 20 SQL Interview Questions

Like this post if you want me to continue this SQL Interview Series♥️

Share with credits: https://news.1rj.ru/str/sqlspecialist

Hope it helps :)
👍1810
Which of the following loop is not available in Python?
Anonymous Quiz
6%
While loop
85%
Do while loop
10%
For loop
👌52👍1🥰1
Data Analytics
SQL Interview Questions with detailed answers: 4️⃣ How do you remove duplicate rows from a table? To remove duplicate rows, you can use the DISTINCT keyword in a SELECT query. Example: SELECT DISTINCT column_name FROM table_name; Explanation: DISTINCT…
SQL Interview Questions with detailed answers:

5️⃣ Difference between RANK(), DENSE_RANK(), and ROW_NUMBER()

1️⃣ RANK() assigns a rank to each row based on the specified order. If two rows have the same value, they get the same rank, but the next rank is skipped.
Example: If two employees have the same salary and rank as 2, the next rank will be 4 (skipping 3).

SELECT employee_id, salary, 
RANK() OVER (ORDER BY salary DESC) AS rank
FROM employees;


2️⃣ DENSE_RANK() is similar to RANK(), but it does not skip ranks when there are ties.
Example: If two employees share rank 2, the next rank will be 3 instead of skipping it.

SELECT employee_id, salary, 
DENSE_RANK() OVER (ORDER BY salary DESC) AS dense_rank
FROM employees;


3️⃣ ROW_NUMBER() assigns a unique number to each row, even if the values are the same. No ties occur, and every row gets a unique sequential number.

SELECT employee_id, salary, 
ROW_NUMBER() OVER (ORDER BY salary DESC) AS row_num
FROM employees;


⬇️ Key Differences:

RANK() skips numbers when there are duplicates.

DENSE_RANK() does not skip numbers and assigns the next rank sequentially.

ROW_NUMBER() does not allow ties and gives every row a unique number.

Top 20 SQL Interview Questions

Like this post if you want me to continue this SQL Interview Series♥️

Share with credits: https://news.1rj.ru/str/sqlspecialist

Hope it helps :)
👍1711👏2🥰1🎉1
Which of the following is not a window function?
Anonymous Quiz
4%
RANK()
15%
DENSE_RANK()
25%
LEAD()
48%
SORT()
9%
ROW_NUMBER()
👍95
Data Analytics
Which of the following is not a window function?
Here is the list of most widely used window functions in SQL:

ROW_NUMBER(): Assigns consecutive numbers starting from 1 to all rows in the table
RANK: Assigns a rank value to each row within each ordered partition of a result set
NTILE(): Returns the group number for each of the rows in the partition
LEAD() and LAG(): Compares the rows with their previous or next rows
PERCENTILE_CONT: Compares each employee's salary with the average salary in his or her department

And SORT() is not even a valid command in SQL. For sorting, we use ORDER BY clause in SQL.

Hope it helps :)
👍245
Data Analytics
SQL Interview Questions with detailed answers: 5️⃣ Difference between RANK(), DENSE_RANK(), and ROW_NUMBER() 1️⃣ RANK() assigns a rank to each row based on the specified order. If two rows have the same value, they get the same rank, but the next rank is…
SQL Interview Questions with detailed answers:

6️⃣ How do you find the second highest salary from an Employee table?

There are multiple ways to find the second highest salary in SQL. Here are three common approaches:

1️⃣ Using LIMIT and OFFSET (MySQL, PostgreSQL, etc.)

SELECT DISTINCT salary FROM employees ORDER BY salary DESC LIMIT 1 OFFSET 1; 


Explanation:
ORDER BY salary DESC sorts salaries in descending order.
LIMIT 1 OFFSET 1 skips the highest salary (OFFSET 1) and retrieves the next highest.


2️⃣ Using RANK() (Works in SQL Server, PostgreSQL, MySQL 8+)

SELECT salary FROM ( SELECT salary, RANK() OVER (ORDER BY salary DESC) AS rnk FROM employees ) ranked_salaries WHERE rnk = 2; 


Explanation:
The inner query assigns a RANK() to each salary.
The outer query filters for rnk = 2 to get the second highest salary.


3️⃣ Using MAX() and NOT IN (Works in all SQL versions)

SELECT MAX(salary) FROM employees WHERE salary NOT IN (SELECT MAX(salary) FROM employees); 


Explanation:
The subquery finds the highest salary.
The main query finds the maximum salary excluding the highest one.
Each approach depends on the database system you are using.

Top 20 SQL Interview Questions

Like this post if you want me to continue this SQL Interview Series♥️

Share with credits: https://news.1rj.ru/str/sqlspecialist

Hope it helps :)
👍1811
Which of the following join is not available in SQL?
Anonymous Quiz
4%
INNER JOIN
20%
CROSS JOIN
57%
UPPER JOIN
19%
SELF JOIN
👍2
Data Analytics
SQL Interview Questions with detailed answers: 6️⃣ How do you find the second highest salary from an Employee table? There are multiple ways to find the second highest salary in SQL. Here are three common approaches: 1️⃣ Using LIMIT and OFFSET (MySQL,…
SQL Interview Questions with detailed answers:

7️⃣ What is a Common Table Expression (CTE), and when should you use it?

A Common Table Expression (CTE) is a temporary result set that can be referenced within a SELECT, INSERT, UPDATE, or DELETE statement. It improves code readability and allows recursive queries.

Syntax of a CTE

WITH cte_name AS ( SELECT column1, column2 FROM table_name WHERE condition ) SELECT * FROM cte_name; 


Example: Using CTE to Find Employees with High Salaries

WITH HighSalaryEmployees AS ( SELECT employee_id, first_name, salary FROM employees WHERE salary > 70000 ) SELECT * FROM HighSalaryEmployees; 


When to Use CTEs?

1️⃣ Improve Readability – Makes complex queries easier to understand.
2️⃣ Avoid Subquery Repetition – Instead of repeating subqueries, define them once in a CTE.
3️⃣ Enable Recursion – Useful for hierarchical data like employee-manager relationships.

Top 20 SQL Interview Questions

Like this post if you want me to continue this SQL Interview Series♥️

Share with credits: https://news.1rj.ru/str/sqlspecialist

Hope it helps :)
👍2117👌1
Which of the following is not an aggregate function in SQL?
Anonymous Quiz
11%
SUM()
16%
MIN()
67%
MEAN()
6%
AVG()
👍19🥰1👌1
Data Analytics
SQL Interview Questions with detailed answers: 7️⃣ What is a Common Table Expression (CTE), and when should you use it? A Common Table Expression (CTE) is a temporary result set that can be referenced within a SELECT, INSERT, UPDATE, or DELETE statement.…
SQL Interview Questions with detailed answers:

8️⃣ How do you identify missing values in a dataset using SQL?

In SQL, missing values are usually represented as NULL. You can detect them using the IS NULL condition.

Basic Query to Find NULL Values in a Column

SELECT * FROM employees WHERE salary IS NULL; 


This retrieves all employees where the salary is missing.

Find Missing Values in Multiple Columns

SELECT * FROM employees WHERE salary IS NULL OR department_id IS NULL; 


This checks for NULL values in both the salary and department_id columns.

Count Missing Values in Each Column

SELECT COUNT(*) AS total_rows, COUNT(salary) AS non_null_salaries, COUNT(department_id) AS non_null_departments FROM employees; 


Since COUNT(column_name) ignores NULL values, subtracting it from COUNT(*) gives the number of missing values.

Top 20 SQL Interview Questions

Like this post if you want me to continue this SQL Interview Series♥️

Share with credits: https://news.1rj.ru/str/sqlspecialist

Hope it helps :)
21👍14
Which of the following python library is used for data visualization?
Anonymous Quiz
76%
Matplotlib
18%
Numpy
2%
Keras
3%
Flask
👍2
Data Analytics
Which of the following python library is used for data visualization?
Here are some most popular Python libraries for data visualization:

Matplotlib – The most fundamental library for static charts. Best for basic visualizations like line, bar, and scatter plots. Highly customizable but requires more coding.

Seaborn – Built on Matplotlib, it simplifies statistical data visualization with beautiful defaults. Ideal for correlation heatmaps, categorical plots, and distribution analysis.

Plotly – Best for interactive visualizations with zooming, hovering, and real-time updates. Great for dashboards, web applications, and 3D plotting.

Bokeh – Designed for interactive and web-based visualizations. Excellent for handling large datasets, streaming data, and integrating with Flask/Django.

Altair – A declarative library that makes complex statistical plots easy with minimal code. Best for quick and clean data exploration.

For static charts, start with Matplotlib or Seaborn. If you need interactivity, use Plotly or Bokeh. For quick EDA, Altair is a great choice.

Share with credits: https://news.1rj.ru/str/sqlspecialist

Hope it helps :)

#python
8👍8
Data Analytics
SQL Interview Questions with detailed answers: 8️⃣ How do you identify missing values in a dataset using SQL? In SQL, missing values are usually represented as NULL. You can detect them using the IS NULL condition. Basic Query to Find NULL Values in a…
SQL Interview Questions with detailed answers:

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

Both UNION and UNION ALL are used to combine the results of two or more SELECT queries, but they handle duplicate records differently.

1️⃣ UNION (Removes Duplicates)
Combines result sets and removes duplicate rows automatically.

It performs an implicit DISTINCT operation, which may affect performance.

SELECT employee_id, department_id FROM employees UNION SELECT employee_id, department_id FROM managers; 


2️⃣ UNION ALL (Keeps Duplicates)

Combines result sets without removing duplicates.
Faster than UNION because it doesn’t perform duplicate elimination.

SELECT employee_id, department_id FROM employees UNION ALL SELECT employee_id, department_id FROM managers; 


Key Differences:

UNION removes duplicates, which may cause performance overhead.

UNION ALL keeps all records, making it more efficient.

Top 20 SQL Interview Questions

Like this post if you want me to continue this SQL Interview Series♥️

Share with credits: https://news.1rj.ru/str/sqlspecialist

Hope it helps :)
👍1713