Poll
click to show
2 · 3.8K · click to show
Poll
click to show
2 · 3.9K · click to show
Poll
click to show
2 · 4.2K · click to show
Data Analytics
Photo
click to show
click to show
🚀 𝗧𝗼𝗽 𝟳 𝗙𝗥𝗘𝗘 𝗠𝗶𝗰𝗿𝗼𝘀𝗼𝗳𝘁 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 𝘁𝗼 𝗟𝗲𝗮𝗿𝗻 𝗗𝗮𝘁𝗮 𝗔𝗻𝗮𝗹𝘆𝘁𝗶𝗰𝘀! 📊
Want to start a career in Data Analytics?
Explore these 7 free Microsoft-backed learning resources covering Power BI, Excel, SQL and data fundamentals
🔗 𝗔𝗰𝗰𝗲𝘀𝘀 𝘁𝗵𝗲 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 👇
https://pdlink.in/3Tm2D3Z
💡 Ideal for students, freshers and professionals who want to build practical data skills.
2 · 3.5K · Data Analytics
🚀 SQL & Python Quick Cheatsheet for Beginners
🗄️ SQL Programming
1. What is SQL?
SQL stands for Structured Query Language. It is used to communicate with databases and work with stored data.
You can use SQL to:
✅ Retrieve data
✅ Filter data
✅ Analyze data
✅ Insert data
✅ Update data
✅ Delete data
2. SELECT
Used to retrieve data from a table.
SELECT name, salary
FROM employees;
SELECT → columns you want
FROM → table you want data from
To get all columns:
SELECT *
FROM employees;
3. WHERE
Used to filter rows.
SELECT *
FROM employees
WHERE salary > 50000;
Common operators:
= Equal
Greater than
< Less than
= Greater than or equal
<= Less than or equal
<> Not equal
4. AND, OR, NOT
Used to combine conditions.
SELECT *
FROM employees
WHERE salary > 50000
AND department = 'IT';
AND → both conditions must be true.
SELECT *
FROM employees
WHERE department = 'IT'
OR department = 'HR';
OR → at least one condition must be true.
5. ORDER BY
Used to sort your results.
SELECT *
FROM employees
ORDER BY salary DESC;
ASC → Lowest to highest
DESC → Highest to lowest
6. DISTINCT
Used to remove duplicate values.
SELECT DISTINCT department
FROM employees;
7. LIMIT
Used to restrict the number of rows returned.
SELECT *
FROM employees
LIMIT 10;
Note: Some databases use TOP or FETCH.
8. Aggregate Functions
Used to perform calculations on multiple rows.
COUNT() -- Count
SUM() -- Total
AVG() -- Average
MIN() -- Minimum
MAX() -- Maximum
Example:
SELECT AVG(salary)
FROM employees;
9. GROUP BY
Used to create groups and calculate results for each group.
SELECT
department,
AVG(salary) AS average_salary
FROM employees
GROUP BY department;
10. HAVING
Used to filter grouped results.
SELECT
department,
AVG(salary) AS average_salary
FROM employees
GROUP BY department
HAVING AVG(salary) > 70000;
WHERE → filters rows
HAVING → filters groups
🐍 Python — Beginner Fundamentals
1. What is Python?
Python is a genera
14 · 3.6K · employee = {
"name": "Alex",
"age": 25,
"salary": 50000
}
employee["name"] # Output: Alex
9. Tuples
Tuples store ordered values that cannot normally be changed.
coordinates = (10, 20)
10. Sets
Sets store unique values.
numbers = {1, 2, 2, 3}
# Result: {1, 2, 3}
SQL Resources: https://whatsapp.com/channel/0029VanC5rODzgT6TiTGoa1v
❤️ Double Tap & React For More!
6 · 4.2K · Data Analytics
Photo
click to show
click to show
🚀 𝐁𝐞𝐜𝐨𝐦𝐞 𝐚𝐧 𝐀𝐈 𝐄𝐧𝐠𝐢𝐧𝐞𝐞𝐫 𝐢𝐧 𝟐𝟎𝟐𝟔
🎯 Choose Your Learning Track:
💻 Java Full Stack + AI Engineering
🌐 MERN Full Stack + AI Engineering
Placement Highlights: ₹41 LPA highest package | ₹7.4 LPA average package | 2,000+ students placed | 500+ hiring partners
🔗 𝗕𝗼𝗼𝗸 𝗙𝗥𝗘𝗘 𝗗𝗲𝗺𝗼 𝗖𝗹𝗮𝘀𝘀 :- https://pdlink.in/4fWJVID
⚡ AI is creating new career opportunities—start building the skills companies need in 2026!
4K · Learn SQL from basic to advanced level in 30 days
Week 1: SQL Basics
Day 1: Introduction to SQL and Relational Databases
Overview of SQL Syntax
Setting up a Database (MySQL, PostgreSQL, or SQL Server)
Day 2: Data Types (Numeric, String, Date, etc.)
Writing Basic SQL Queries:
SELECT, FROM
Day 3: WHERE Clause for Filtering Data
Using Logical Operators:
AND, OR, NOT
Day 4: Sorting Data: ORDER BY
Limiting Results: LIMIT and OFFSET
Understanding DISTINCT
Day 5: Aggregate Functions:
COUNT, SUM, AVG, MIN, MAX
Day 6: Grouping Data: GROUP BY and HAVING
Combining Filters with Aggregations
Day 7: Review Week 1 Topics with Hands-On Practice
Solve SQL Exercises on platforms like HackerRank, LeetCode, or W3Schools
Week 2: Intermediate SQL
Day 8: SQL JOINS:
INNER JOIN, LEFT JOIN
Day 9: SQL JOINS Continued: RIGHT JOIN, FULL OUTER JOIN, SELF JOIN
Day 10: Working with NULL Values
Using Conditional Logic with CASE Statements
Day 11: Subqueries: Simple Subqueries (Single-row and Multi-row)
Correlated Subqueries
Day 12: String Functions:
CONCAT, SUBSTRING, LENGTH, REPLACE
Day 13: Date and Time Functions: NOW, CURDATE, DATEDIFF, DATEADD
Day 14: Combining Results: UNION, UNION ALL, INTERSECT, EXCEPT
Review Week 2 Topics and Practice
Week 3: Advanced SQL
Day 15: Common Table Expressions (CTEs)
WITH Clauses and Recursive Queries
Day 16: Window Functions:
ROW_NUMBER, RANK, DENSE_RANK, NTILE
Day 17: More Window Functions:
LEAD, LAG, FIRST_VALUE, LAST_VALUE
Day 18: Creating and Managing Views
Temporary Tables and Table Variables
Day 19: Transactions and ACID Properties
Working with Indexes for Query Optimization
Day 20: Error Handling in SQL
Writing Dynamic SQL Queries
Day 21: Review Week 3 Topics with Complex Query Practice
Solve Intermediate to Advanced SQL Challenges
Week 4: Database Management and Advanced Applications
Day 22: Database Design and Normalization:
1NF, 2NF, 3NF
Day 23: Constraints in SQL:
PRIMARY KEY, FOREIGN KEY, UN
31 · 3.6K · Data Analytics
Photo
click to show
click to show
🚀 𝗚𝗼𝗼𝗴𝗹𝗲 𝗣𝗿𝗼𝗳𝗲𝘀𝘀𝗶𝗼𝗻𝗮𝗹 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗲𝘀 𝗶𝗻 𝗗𝗮𝘁𝗮 𝗔𝗻𝗮𝗹𝘆𝘁𝗶𝗰𝘀 & 𝗔𝗜! 📊
Explore these 4 Google learning programs and develop practical, career-relevant skills.
🎓 Explore the programs:
1️⃣ Google Data Analytics Professional Certificate
2️⃣ Google Business Intelligence Professional Certificate
3️⃣ Google AI Essentials
4️⃣ Google Advanced Data Analytics Professional Certificate
🔗 𝗘𝗻𝗿𝗼𝗹𝗹 𝗳𝗼𝗿 𝗙𝗥𝗘𝗘 👇:-
https://pdlink.in/4htgIEW
📌 Save this post and share it with someone interested in Data Analytics or AI!
12 · 2.4K · 🚀 Data Analyst Roadmap — Part 29
POWER BI LEVEL 8 — ADVANCED DAX: FILTER(), VALUES(), SELECTEDVALUE() & DYNAMIC CALCULATIONS
Now let's move into DAX functions that help you build more dynamic Power BI reports.
These functions are especially useful when your calculation needs to react to slicers, selections, or the current report context.
🔹 1. FILTER()
You already know that FILTER() can create a filtered table.
Example:
High Value Sales =
CALCULATE(
[Total Sales],
FILTER(
Sales,
Sales[SalesAmount] > 10000
)
)
This keeps only transactions where SalesAmount is greater than 10,000.
The important thing to understand:
• "FILTER()" works with a table and evaluates a condition for each row.
• Use it when your filtering requirement is more complex than a simple condition.
🔹 2. VALUES()
"VALUES()" returns the unique values from a column based on the current filter context.
Example:
Customer Count =
COUNTROWS(
VALUES(Sales[CustomerID])
)
This counts the unique customers visible in the current context.
For example:
• Without filters → 1,000 customers
• Region = West → 250 customers
• Region = South → 300 customers
The result changes according to the report filters.
🔹 3. VALUES() vs DISTINCT()
Both can return unique values, but they aren't identical in every situation.
A useful beginner-level rule:
• "DISTINCT()" → returns unique values from a column.
• "VALUES()" → returns unique values while also being sensitive to the current DAX context and can include a blank value when appropriate.
In advanced DAX, "VALUES()" is extremely useful for understanding what values are currently available in the filter context.
🔹 4. SELECTEDVALUE()
This is one of the most useful functions for interactive reports.
Suppose you have a Region slicer.
You can write:
Selected Region =
SELECTEDVALUE(
Sales[Region],
"Multiple Regions"
)
If the user selects:
• West → Result: West
• West + South → Result: Multiple Regions
If nothin
9 · 2.1K · Performance =
SWITCH(
TRUE(),
[Profit Margin] >= 0.30, "Excellent",
[Profit Margin] >= 0.15, "Good",
[Profit Margin] >= 0, "Needs Improvement",
"Loss"
)
It evaluates conditions and returns the corresponding result.
This is useful for:
✔ KPI categories
✔ Business rules
✔ Dynamic labels
✔ Conditional calculations
✔ Performance classification
🔹 10. Building a Dynamic Customer Message
You can combine these functions to create business-friendly messages.
Example:
Customer Message =
"Selected Customers: "
&
COUNTROWS(VALUES(Sales[CustomerID]))
If the current filter context contains 125 unique customers:
• Selected Customers: 125
This can be displayed inside a Card or used in a report title.
🔹 11. Why These Functions Matter
Real dashboards rarely show the same calculation under every situation.
Users interact with:
• Slicers
• Filters
• Drill-downs
• Cross-highlighting
• Page filters
Your DAX measures should respond appropriately.
Functions such as:
• "FILTER()"
• "VALUES()"
• "SELECTEDVALUE()"
• "HASONEVALUE()"
• "SWITCH()"
help you build that dynamic behavior.
🎯 Interview Questions
1️⃣ What does FILTER() do?
• It returns a filtered table based on a specified condition.
2️⃣ What does SELECTEDVALUE() return?
• The single value in the current context, or an alternate result when there isn't exactly one value.
3️⃣ What is HASONEVALUE() used for?
• To check whether exactly one unique value exists in the current filter context.
4️⃣ How can SELECTEDVALUE() be used in a dashboard?
• It can create dynamic titles, labels, messages, and calculations based on slicer selections.
5️⃣ Why is SWITCH() useful in DAX?
• It allows multiple conditions or selections to determine which result should be returned.
🧪 PRACTICE
Create a Region slicer.
Then create:
✔ Selected Region
✔ Customer Count
✔ Dynamic Sales Title
✔ Dynamic KPI using SWITCH()
✔ One Region / Multiple Regions indicator
Select different regions and observe ho
8 · 2.5K · Data Analytics
Photo
click to show
click to show
𝗟𝗲𝘃𝗲𝗹 𝗨𝗽 𝗬𝗼𝘂𝗿 𝗦𝗸𝗶𝗹𝗹𝘀 𝘄𝗶𝘁𝗵 𝗧𝗵𝗲𝘀𝗲 𝗚𝗮𝗺𝗲-𝗖𝗵𝗮𝗻𝗴𝗶𝗻𝗴 𝗖𝗼𝘂𝗿𝘀𝗲𝘀!
Looking to learn practical, in-demand skills? These courses cover Generative AI, Cybersecurity, AI tools and Digital Marketing.
💫 Learn at your own pace
⚡Build career-relevant skills
🔥Practical learning opportunities
𝗘𝘅𝗽𝗹𝗼𝗿𝗲 𝘁𝗵𝗲 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 :-
https://pdlink.in/4z3vOYU
Save this post and share with your friends
2 · 2.7K · ✅ SQL Interview Questions with Answers
1. What is a window function?
A window function computes results over a group ("window") of rows related to the current row, without collapsing them (like GROUP BY).
Examples: ROW_NUMBER(), RANK(), SUM() OVER(...) for running totals, rankings, or moving averages.
2. What is the difference between RANK() and ROW_NUMBER()?
• ROW_NUMBER(): assigns unique sequential numbers to all rows, even if values are equal.
• RANK(): gives same rank to tied values, then skips the next rank (e.g., 1, 1, 3).
3. How do you find the second highest salary?
SELECT salary
FROM (
SELECT salary, DENSE_RANK() OVER (ORDER BY salary DESC) as rnk
FROM employees
) t
WHERE rnk = 2;
This avoids ties if you want exactly the second‑highest value.
4. What is a recursive CTE?
A recursive CTE refers to itself in its WITH definition, usually in the form "anchor + UNION ALL recursive step". It is used for hierarchical data like managers‑employees, org charts, or tree structures.
5. What is the difference between correlated and non-correlated subquery?
• Non‑correlated: runs once, independent of the outer query.
• Correlated: references columns from the outer query and runs once per outer row (e.g., SELECT ... FROM t1 WHERE col > (SELECT AVG(col) FROM t2 WHERE t2.id = t1.id)).
6. How do you remove duplicates without DISTINCT?
Use window functions:
DELETE FROM (
SELECT ROW_NUMBER() OVER (PARTITION BY col1, col2 ORDER BY id) as rn
FROM table
) t
WHERE rn > 1;
Or use GROUP BY and keep one row per group.
7. What is an INDEX and when do you use it?
An index speeds up data retrieval on specified columns (used in WHERE, JOIN, ORDER BY). Use it on columns that are frequently filtered or joined; avoid on very small tables or columns updated often.
8. Explain self-join with example.
A self‑join joins a table to itself using aliases. Example:
SELECT e1.name as employee, e2.name as manager
FROM employees e1
LEFT JOI
19 · 2.6K · Data Analytics
Photo
click to show
click to show
🎓 𝗛𝗔𝗥𝗩𝗔𝗥𝗗 𝗨𝗡𝗜𝗩𝗘𝗥𝗦𝗜𝗧𝗬 𝗙𝗥𝗘𝗘 𝗢𝗡𝗟𝗜𝗡𝗘 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 😍
Dreaming of learning from one of the world’s most prestigious universities? Explore Harvard’s online courses and build valuable, career-ready skills from home!
💡 Beginner-friendly options
⏰ Learn at your own pace
🌍 Accessible online worldwide
🎯 Ideal for students, freshers and working professionals
🔗 𝗘𝘅𝗽𝗹𝗼𝗿𝗲 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 👇
https://pdlink.in/4xPUdzU
📢 Share this valuable opportunity with your friends and classmates!
3 · 1.9K · 🚀 Data Analyst Roadmap — Part 30
POWER BI LEVEL 9 — DAX VARIABLES: VAR, RETURN & CLEANER DAX
As DAX calculations become more complex, writing everything in one expression can make your measures difficult to understand and maintain.
That's where VAR and RETURN become extremely useful.
🔹 1. What is VAR?
VAR allows you to store the result of a calculation in a variable.
Example:
Profit =
VAR Revenue = [Total Sales]
VAR Cost = [Total Cost]
RETURN
Revenue - Cost
Instead of repeating [Total Sales] and [Total Cost], we give them meaningful names. The calculation becomes easier to read.
🔹 2. What does RETURN do?
RETURN tells DAX which final result should be returned.
VAR → Create temporary values
RETURN → Give me the final result
Example:
Profit Margin =
VAR Profit = [Total Profit]
VAR Sales = [Total Sales]
RETURN
DIVIDE(Profit, Sales)
🔹 3. Why use Variables?
Without variables:
Profit Margin =
DIVIDE(
[Total Sales] - [Total Cost],
[Total Sales]
)
With variables:
Profit Margin =
VAR Sales = [Total Sales]
VAR Cost = [Total Cost]
VAR Profit = Sales - Cost
RETURN
DIVIDE(Profit, Sales)
The second version is easier to understand. You can immediately see: Sales, Cost, Profit, Profit Margin
🔹 4. Variables Can Store Numbers
Example:
Sales Target Status =
VAR Sales = [Total Sales]
VAR Target = 1000000
RETURN
IF(
Sales >= Target,
"Target Achieved",
"Below Target"
)
Now the business rule is much easier to read.
🔹 5. Variables Can Store Text
Variables don't have to contain numbers.
Example:
Region Message =
VAR Region =
SELECTEDVALUE(
Sales[Region],
"Multiple Regions"
)
RETURN
"Current Region: " & Region
If West is selected: "Current Region: West"
🔹 6. Variables Can Store Tables
This is where DAX starts becoming more powerful. A variable can also contain a table expression.
Example:
High Value Customers =
VAR Customers =
FILTER(
VALUES(Sales[CustomerID
7 · 1.6K · This is much easier to maintain than repeatedly writing [Total Sales].
🔹 12. Best Practices
When writing complex DAX:
✔ Give variables meaningful names
✔ Break complicated calculations into logical steps
✔ Avoid repeating the same expression
✔ Use RETURN for the final result
✔ Keep business logic readable
✔ Use variables to make debugging easier
Avoid meaningless names such as VAR X =...
Prefer VAR TotalSales =...
Clear names make your DAX easier for another analyst to understand.
🎯 Interview Questions
1️⃣ What is VAR in DAX?
VAR creates a temporary variable that stores a value or table expression during calculation.
2️⃣ What does RETURN do?
It specifies the final expression that the measure should return.
3️⃣ Are DAX variables stored permanently in the model?
No. Variables exist only during the evaluation of the expression.
4️⃣ Why should you use variables?
They improve readability, reduce repeated calculations, and make complex DAX easier to debug.
5️⃣ Can a DAX variable contain a table?
Yes. A variable can store either a scalar value or a table expression.
🧪 PRACTICE
Create these measures using VAR:
✔ Total Profit
✔ Profit Margin
✔ Sales Target Status
✔ Sales Performance
✔ Selected Region Message
Then try to rewrite one of your older complex DAX measures using variables.
💡 Double Tap ❤️ For More
6 · 1.7K · Data Analytics
📊 Data Analyst Interview Series — Part 1
Guys, let's start a Data Analyst Interview Series where I'll cover the most important questions that are commonly asked in Data Analyst interviews.
I'll cover SQL, Excel, Power BI, Python, statistics, data cleaning, case studies, business questions, and scenario-based questions.
Let's start with the basics 👇
1️⃣ Tell me about yourself.
Sample Answer:
"I'm a Data Analyst with experience working with SQL, Excel, Power BI, Python, and data visualization. My work involves extracting and transforming data, analyzing business problems, building dashboards, and automating repetitive reporting processes. I focus not just on creating reports, but on understanding the business requirement and converting data into actionable insights."
2️⃣ What does a Data Analyst do?
Sample Answer:
"A Data Analyst collects, cleans, transforms, and analyzes data to help businesses make informed decisions. A typical workflow involves understanding the business requirement, collecting relevant data, cleaning it, performing analysis, identifying trends or patterns, and presenting the findings through reports or dashboards."
3️⃣ What is the difference between Data Analysis and Data Analytics?
Sample Answer:
"Data analysis generally focuses on examining data to understand what happened and why. Data analytics is a broader concept that includes data analysis along with processes such as data collection, preparation, visualization, statistical analysis, and sometimes predictive modeling. In practice, the terms are often used interchangeably depending on the organization."
4️⃣ What is the difference between structured and unstructured data?
Sample Answer:
"Structured data has a predefined format or schema, such as rows and columns in a relational database. Examples include customer IDs, transaction amounts, and dates.
Unstructured data does not follow a predefined tabular structure. Examples include emails, images, videos, documents, and social
17 · 1.7K · "After identifying duplicates, I investigate whether they are genuine duplicate records or legitimate repeated transactions before removing anything."
8️⃣ What is an outlier? How would you handle it?
Sample Answer:
"An outlier is a value that is significantly different from the typical observations in a dataset.
I wouldn't automatically remove an outlier. First, I would investigate whether it represents a data-quality issue or a genuine business event.
For example, a transaction worth ₹10 million might initially look like an outlier, but it could be a legitimate high-value transaction. If it is a data-entry error, I would correct or exclude it according to the business rules."
9️⃣ What is the difference between a dimension and a measure?
Sample Answer:
"A dimension is generally used to categorize or describe data, while a measure is a numerical value that can usually be aggregated.
For example, in a sales dataset:
Dimensions: Customer, Product, Region, Date
Measures: Sales Amount, Quantity, Profit, Discount
In a dashboard, dimensions are commonly used to slice or group the data, while measures are used to calculate KPIs and metrics."
🔟 What steps do you follow when solving a data analysis problem?
Sample Answer:
"I generally follow a structured approach:
1. Understand the business problem.
2. Define the required metrics and success criteria.
3. Identify the relevant data sources.
4. Extract and validate the data.
5. Clean and transform the data.
6. Perform exploratory analysis.
7. Identify trends, patterns, and anomalies.
8. Validate the results.
9. Communicate the insights using appropriate visualizations.
10. Recommend actions based on the findings.
The most important step is understanding the business question first, because technically correct analysis can still be useless if it doesn't answer the actual business problem."
📌 Double Tap ❤️ For Part-2
14 · 2.7K · Photo
click to show
click to show
𝗙𝗥𝗘𝗘 𝗥𝗲𝘀𝗼𝘂𝗿𝗰𝗲𝘀 𝗧𝗼 𝗟𝗲𝗮𝗿𝗻 𝗔𝗜 𝗶𝗻 𝟮𝟬𝟮𝟲🚀
Explore 6 free resources covering AI fundamentals, tools, deep learning, research and real-world applications.
✅ 100% Free Learning
✅ Beginner-Friendly
✅ AI • ML • Deep Learning
✅ Real-World Applications
🔗 𝗘𝘅𝗽𝗹𝗼𝗿𝗲 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 👇
https://pdlink.in/4AFHq5R
📢 Share this valuable opportunity with your friends and classmates!
2 · 2.3K · 📊 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 establishe
11 · 2.7K · 🔟 How would you find duplicate records in SQL?
Sample Answer:
"I would first identify the column or combination of columns that should uniquely identify a record. Then I would use GROUP BY and HAVING COUNT(*) > 1."
SELECT Customer_ID, COUNT(*) AS Count_Records
FROM Customers
GROUP BY Customer_ID
HAVING COUNT(*) > 1;
"This identifies Customer_ID values that appear more than once. I would then investigate whether those records are genuine duplicates before taking any corrective action."
📌 Double Tap ❤️ For Part-3
11 · 3.2K · Data Analytics
📊 Data Analyst Interview Series — Part 3
Guys, let's continue our Data Analyst Interview Series.
Today, let's cover 10 important SQL interview questions that test your practical SQL knowledge. 👇
1️⃣ What is a subquery in SQL?
Sample Answer:
“A subquery is a query written inside another SQL query. It can be used to retrieve intermediate results that are then used by the outer query.
For example, to find employees whose salary is greater than the average salary:”
SELECT Employee_ID, Salary
FROM Employees
WHERE Salary > (
SELECT AVG(Salary)
FROM Employees
);
2️⃣ What is a CTE?
Sample Answer:
“CTE stands for Common Table Expression. It allows us to define a temporary named result set using the WITH clause, which can then be referenced within the main query.
CTEs make complex queries easier to read, maintain, and debug.”
WITH CustomerSales AS (
SELECT Customer_ID,
SUM(Sales) AS Total_Sales
FROM Sales
GROUP BY Customer_ID
)
SELECT *
FROM CustomerSales
WHERE Total_Sales > 100000;
3️⃣ What is a window function?
Sample Answer:
“A window function performs a calculation across a set of related rows while still retaining the individual rows in the result.
Unlike GROUP BY, it does not collapse multiple rows into a single row.
Common window functions include ROW_NUMBER(), RANK(), DENSE_RANK(), LAG(), and LEAD().”
4️⃣ What is the difference between RANK(), DENSE_RANK(), and ROW_NUMBER()?
Sample Answer:
“ROW_NUMBER() assigns a unique sequential number to every row.
RANK() assigns the same rank to tied values but leaves gaps after a tie.
DENSE_RANK() also assigns the same rank to tied values but does not leave gaps.”
Example:
Values: 100, 100, 90
ROW_NUMBER: 1, 2, 3
RANK: 1, 1, 3
DENSE_RANK: 1, 1, 2
5️⃣ How would you find the second-highest salary?
Sample Answer:
“One approach is to use DENSE_RANK(). This also handles duplicate salaries correctly.”
WITH RankedEmployees AS (
SELECT Employee_ID,
Salary,
1 · 367 · 9️⃣ How would you calculate month-over-month growth?
Sample Answer:
“I would first retrieve the previous month's sales using LAG(), then calculate the percentage change between the current month and previous month.”
SELECT Month,
Sales,
LAG(Sales) OVER (ORDER BY Month) AS Previous_Sales,
(Sales - LAG(Sales) OVER (ORDER BY Month))
* 100.0 /
LAG(Sales) OVER (ORDER BY Month) AS MoM_Growth
FROM Monthly_Sales;
“I would also handle cases where the previous month's value is zero or NULL to avoid incorrect calculations.”
🔟 What is the difference between DELETE, TRUNCATE, and DROP?
Sample Answer:
“DELETE removes selected rows from a table and can be used with a WHERE condition.
TRUNCATE removes all rows from a table while keeping the table structure.
DROP removes the entire table, including its structure and data.
So, the key difference is whether I'm removing specific records, all records, or the entire table itself.”
📌 Double Tap ❤️ For Part-4
1 · 441 ·