TGViewer
Channel Public Channel
Data Analytics

Data Analytics

@sqlspecialist

Perfect channel to learn Data Analytics

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

For Promotions: @coderfun @love_data
Subscribers
111K
Photos
226
Videos
1
Links
953

Showing posts older than #2711 · Back to latest

Older Posts 20 shown
Post #2710 6.9K
  • ❤ 3
  • 😁 1
Post #2708 8.06K
🔥 Thanks for the amazing response on SQL Roadmap

Let’s start with the first topic of the SQL Roadmap:

✅ What is SQL & How Databases Work

🧠 What is SQL?
SQL (Structured Query Language) is used to communicate with databases.

👉 In simple words: SQL helps you store, retrieve, update, and delete data.

Think like this 👇
Excel → You manually filter data
SQL → You write a query → Data comes instantly ⚡

🗃 What is a Database?
A database is a place where data is stored in an organized way.

Example: Student records, Employee data, Orders from an e-commerce website

📊 Types of Databases

1️⃣ Relational Database (RDBMS)
- Data stored in tables (rows & columns)
- Uses SQL
- Example: MySQL, PostgreSQL

2️⃣ Non-Relational Database (NoSQL)
- Data stored as JSON, documents, key-value
- Flexible structure
- Example: MongoDB

🧩 Key Terms You Must Know
- Table → Like Excel sheet
- Row → One record (one entry)
- Column → One field (like name, age)
- Primary Key → Unique ID (no duplicates)

Example Table:

id name salary
1 Amit 50000
2 Ravi 60000

⚙️ How SQL Works (Simple Flow)
1️⃣ You write a query
2️⃣ Database processes it
3️⃣ Result is returned

Example: SELECT * FROM employees;

👉 This means: “Give me all data from employees table”

💡 Real-Life Example
Imagine Swiggy/Zomato 🍔 When you search “Pizza”:

👉 SQL runs in background
👉 Fetches restaurants with pizza
👉 Shows results instantly

🎯 Your Task Today
✔ Install MySQL Workbench or PostgreSQL
✔ Understand tables, rows, columns
✔ Run your first query (SELECT *)
✔ Explore any sample database

🔥 Pro Tip
Don’t just read → Try everything practically
SQL is 90% practice, 10% theory

Double Tap ❤️ For More
  • ❤ 42
Post #2707 6.4K
🔢 16) How do you merge customer and orders dataframes on customer_id?
👉 Answer:
# Keep all customers (even no orders)
merged = pd.merge(customers, orders, on='customer_id', how='left')
LEFT JOIN = Industry standard for customer analytics!

📉 17) What are 5 must-have KPIs for an e-commerce dashboard?
👉 Answer:
1. Revenue (vs target)
2. AOV
3. Conversion Rate
4. Cart Abandonment
5. Customer Acquisition Cost. Trend + Target + YoY always!

⚙️ 18) Your SQL query is running slow. How do you optimize?
👉 Answer:
Top 5 fixes:
1. Indexes on WHERE/JOIN columns
2. EXPLAIN query plan
3. Avoid SELECT *
4. Limit subqueries
5. Aggregate at source.

🧠 19) Tell me about a time your data analysis failed. What happened?
👉 Answer: Situation: Dashboard showed wrong trends. Problem: Timezone mismatch in sales data. Fix: Added CONVERT_TZ() in SQL + data validation layer. Result: 100% accuracy, saved stakeholder trust.

💬 20) Do you have any questions for us?
👉 Answer: 1. What are the top 3 metrics leadership cares about? 2. What's your biggest data challenge? 3. How do you measure success in this role after 90 days?

Double Tap ❤️ For More!
  • ❤ 8
  • 👍 2
Post #2706 5.85K
💼 Top 20 Frequently Asked Data Analyst Interview Questions

🧠 1) Can you walk me through the tools you use for data analysis?
👉 Answer: Absolutely! For data extraction I use SQL to query databases like MySQL and PostgreSQL. For cleaning and analysis, Python with pandas and NumPy is my go-to. Excel for quick pivots and Power BI/Tableau for interactive dashboards. I pick the right tool based on data size and stakeholder needs.

🎯 2) Write a SQL query to find the 2nd highest salary from employees table.
👉 Answer:
SELECT MAX(salary) as second_highest
FROM employees
WHERE salary < (SELECT MAX(salary) FROM employees);
Follow-up: Or using window functions: DENSE_RANK() OVER (ORDER BY salary DESC)

📊 3) Explain INNER JOIN vs LEFT JOIN with a business example.
👉 Answer: INNER JOIN gives only matching records. LEFT JOIN gives all from left table + matches from right.
Example: Customer orders analysis - LEFT JOIN keeps customers with zero orders to see churn patterns.

🔍 4) How would you handle missing values in a sales dataset?
👉 Answer: Step 1: df.isnull().sum() to assess impact. Step 2: For numbers - impute median (df.fillna(df.median())). For categories - mode. Step 3: Flag imputed values for transparency. Never drop >5% without business justification.

🧩 5) What's pandas groupby() and write an example?
👉 Answer:
# Sales by region + month
df.groupby(['region', 'month'])['revenue'].agg({
'mean': 'mean',
'total': 'sum',
'records': 'count'
}).round(2)
Split -> Apply -> Combine pattern!

📈 6) When would you normalize vs denormalize a database?
👉 Answer: Normalize for transactional systems (OLTP) to save storage. Denormalize for analytics (OLAP) for faster queries. Example: Star schema with fact/dimension tables.

🔢 7) VLOOKUP vs INDEX+MATCH - which is better and why?
👉 Answer: INDEX+MATCH wins! VLOOKUP breaks if columns shift and only looks right.
=INDEX(sales_range, MATCH(A2, id_range, 0))
Dynamic, safer, 2-way lookup.

📉 8) Difference between COUNT() vs COUNT(column_name)?
👉 Answer: COUNT(
): Total rows including NULLs. COUNT(column): Non-null values only. Use COUNT() for total records, COUNT(sales) to exclude null sales.

⚙️ 9) How do you identify and remove duplicates in pandas?
👉 Answer:
# Find duplicates
dupe_count = df.duplicated(subset=['email']).sum()
print(f"Found {dupe_count} duplicates")

# Remove (keep first)
df_clean = df.drop_duplicates(subset=['email'], keep='first')
Always check business logic first!

🧠 10) Name 4 SQL aggregate functions with a practical example.
👉 Answer:
SELECT
dept,
COUNT(
) as headcount,
AVG(salary) as avg_salary,
MAX(salary) as top_earner,
SUM(salary) as payroll
FROM employees
GROUP BY dept;
📊 11) Sales dropped 20% last quarter. Walk me through your analysis.
👉 Answer: Framework:
1️⃣ Segment - Product/Category/Region/Customer
2️⃣ Trends - YoY, MoM, seasonality
3️⃣ Funnel - Where drop occurs
4️⃣ External - Competitor pricing, marketing
Dashboard: Drill-down + alerts for anomalies.

🎯 12) What's the difference between Data Analyst and Data Scientist?
👉 Answer: DA: SQL/Excel/Dashboards = 'What happened?' DS: ML/Python/R = 'What will happen?'
Analogy: DA = Rearview mirror, DS = Crystal ball. Most value from clean DA first!

🔍 13) Write a SQL window function to rank salaries by department.
👉 Answer:
SELECT name, dept, salary,
RANK() OVER (PARTITION BY dept ORDER BY salary DESC) as dept_rank
FROM employees;
🧩 14) How do you create a pivot table showing sales by region/month?
👉 Answer: Excel: Insert -> PivotTable -> Rows: Region -> Columns: Month -> Values: Sum of Sales -> Slicers for filters. Power BI: Drag-drop + matrix visual.

📈 15) Explain correlation vs causation with an example.
👉 Answer: Classic: Ice cream sales correlate with drownings (both peak summer)

Correlation ≠ Causation. Need experiments to prove cause-effect.
  • ❤ 11
  • 👍 1
Post #2703 7.82K
✅ Complete Roadmap to Learn SQL (Structured Query Language) 🧠💻

Week 1: SQL Basics
- What is SQL and how databases work
- Install MySQL Workbench or PostgreSQL
- Learn SELECT, FROM, WHERE
- Filtering data with conditions
- Practice basic queries
Example: Fetch all employees, filter salary > 50k

Week 2: Sorting and Aggregation
- ORDER BY (sorting data)
- Aggregate functions: COUNT, SUM, AVG, MIN, MAX
- GROUP BY concept
- HAVING clause
Example: Department-wise average salary

Week 3: Joins (Most Important 🔥)
- INNER JOIN
- LEFT JOIN, RIGHT JOIN
- FULL JOIN
- Self Join
Example: Combine employees and departments tables

Week 4: Advanced Filtering
- IN, BETWEEN, LIKE
- Wildcards (% , _)
- NULL handling (IS NULL, IS NOT NULL)
- CASE statements
Example: Categorize customers based on spending

Week 5: Subqueries
- Nested queries
- Correlated subqueries
- Using subqueries in SELECT, WHERE
Example: Find employees earning above average salary

Week 6: Window Functions (High Value 💰)
- OVER() clause
- ROW_NUMBER(), RANK(), DENSE_RANK()
- PARTITION BY
Example: Rank employees by salary within each department

Week 7: CTE & Views
- Common Table Expressions (WITH)
- Temporary vs permanent views
- Simplify complex queries
Example: Multi-step data transformation

Week 8: Data Modification
- INSERT, UPDATE, DELETE
- TRUNCATE vs DELETE
- Constraints (PRIMARY KEY, FOREIGN KEY)
Example: Update employee salary

Week 9: Indexing & Performance
- What are indexes
- Query optimization basics
- EXPLAIN keyword
Example: Speed up large table queries

Week 10: Working with Real Data
- Import CSV data
- Data cleaning in SQL
- Handling duplicates
- Basic transformations
Example: Clean messy sales dataset

Week 11: Mini Projects
- Write complex queries
- Solve real-world case studies
- Focus on business logic
Examples: Sales dashboard queries, Customer segmentation

Week 12: Final Preparation
- Revise all concepts
- Practice interview questions
- Solve SQL challenges on LeetCode / HackerRank
- Mock interviews

Daily Rule for You
- Practice SQL 60 minutes daily
- Solve 5 queries daily
- Revise previous queries weekly

🔥 Pro Tip
- Focus more on JOINS + WINDOW FUNCTIONS
- Practice real datasets, not just theory
- Think in terms of “business questions”

Double Tap ❤️ For Detailed Explanation
  • ❤ 60
Post #2702 7.58K
𝗜𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄𝗲𝗿: You have 2 minutes to solve this SQL query.
From the employees table, retrieve the employee name, department, and their salary rank within the department (highest salary rank 1).

𝗠𝗲: Challenge accepted!

SELECT 
name,
department,
salary,
DENSE_RANK() OVER (PARTITION BY department ORDER BY salary DESC) AS salary_rank
FROM employees;

I applied DENSE_RANK() window function partitioned by department and ordered by descending salary to assign ranks within each department. Unlike ROW_NUMBER(), DENSE_RANK() handles ties by assigning the same rank without gaps. This is ideal for leaderboards or performance analytics.

𝗧𝗶𝗽 𝗳𝗼𝗿 𝗦𝗤𝗟 𝗝𝗼𝗯 𝗦𝗲𝗲𝗸𝗲𝗿𝘀:
Master window function differences (ROW_NUMBER vs RANK vs DENSE_RANK)—they're interview staples for deduping, paging, and top-N queries!

React with ❤️ for more
  • ❤ 11
  • 👍 8
Post #2700 7.25K
💼 Data Analyst Interview Questions — Part 1 (HR Round) 

🧠 1) Tell me about yourself. 
👉 Answer: 
"I'm a Data Analyst proficient in SQL, Python, Power BI, and Excel. I've built dashboards and delivered business insights from complex datasets. Passionate about turning data into decisions and excited to contribute here!"

🎯 2) Why should we hire you for this Data Analyst role? 
👉 Answer: 
"I deliver actionable insights using SQL, Python, and visualization tools—not just theory. I'm quick to learn new tools and focused on solving real business problems with data."

📉 3) What are your weaknesses as a data analyst? 
👉 Answer: 
"Sometimes I focus too much on perfecting data cleaning, but I'm learning to prioritize impact and use automation to meet deadlines effectively." 

⚠️ Never say "I have no weaknesses"

🚀 4) What are your key strengths? 
👉 Answer: 
"Strong analytical thinking, quick mastery of tools like Power BI/SQL, and ability to simplify complex data into clear business stories."

🧩 5) Describe a challenging situation you faced in a project. 
👉 Answer: 
"Handled messy sales data causing forecast errors. Used Python (pandas) + SQL for cleaning, built Power BI dashboard—improved accuracy 30% and strengthened my ETL skills."

🤝 6) How do you work in a team environment? 
👉 Answer: 
"I communicate insights clearly through dashboards/reports, take ownership of analysis tasks, collaborate via Git/shared drives, and help teammates with SQL queries."

⏳ 7) How do you manage tight deadlines on analysis projects? 
👉 Answer: 
"I prioritize by business impact, break into steps (ETL → analysis → viz), and track progress with Jira/Trello for consistent delivery."

🔄 8) Are you open to learning new data tools and technologies? 
👉 Answer: 
"Absolutely! I continuously upskill in areas like advanced Python ML libraries, Tableau, or cloud analytics to stay impactful."

💬 9) Do you have any questions for us? 
👉 Answer: 
"Yes: 
• What does a typical day look like for a Data Analyst here?
• What tools does your team primarily use (Power BI, Tableau, etc.)?"

🧠 10) Where do you see yourself in 2-3 years? 
👉 Answer: 
"As a Senior Data Analyst leading projects, building predictive models, and driving strategic business decisions with data."

Double Tap ❤️ For More!
  • ❤ 32
  • 👍 1
  • 👎 1
Post #2699 6.12K
18. What is data blending in Power BI? 
Data blending (sometimes confused with “merge”) usually refers to combining fields from multiple tables at the visualization level, often via relationships or calculated columns/measures rather than ETL-level joins.

19. How do you optimize large datasets? 
• Use a star-schema model, avoid unnested structures.
• Use appropriate data types, remove unnecessary columns.
• Prefer measures over large calculated columns, enable incremental refresh, and push heavy filters to the source when possible.

20. What is Get Data? 
“Get Data” (in Power BI Desktop) is the Power Query interface that lets you connect to various sources (SQL, Excel, Web, etc.), load, and transform data into the model.

Double Tap ❤️ For More
  • ❤ 11
Post #2698 6.5K
✅ Power BI Interview Questions with Answers

1. What is DAX? 
DAX (Data Analysis Expressions) is a formula language in Power BI used to create calculated columns, measures, and tables (e.g., SUM(), CALCULATE(), FILTER()) for business logic and KPIs.

2. What is the difference between Power Query and Power Pivot? 
• Power Query: used for data loading, cleaning, and transforming (ETL) before loading into the model.
• Power Pivot: in‑memory data model and engine for DAX calculations and relationships (used during/after load).

3. What is the difference between measure vs calculated column? 
• Measure: calculated at query time, used in visuals (e.g., summaries, ratios).
• Calculated column: computed at refresh time, stored in the model (uses more memory). Prefer measures for aggregations.

4. Explain CALCULATE() function. 
CALCULATE() changes the context of a calculation by applying filters. 
Example: Total Sales = CALCULATE(SUM(Sales[Amount]), Sales[Region] = "West") computes sum only for West region.

5. What are relationships (1:M, M:M)? 
• 1:M (one‑to‑many): one row in the “1” table links to many rows in the “M” table (most common).
• M:M (many‑to‑many): handled via an intermediate bridge table with foreign keys on both sides.

6. How do you handle many‑to‑many? 
Create a bridge table (junction table) that contains foreign keys to both related tables. Then set 1:M relationships from each original table to the bridge.

7. What is row‑level security (RLS)? 
RLS restricts which rows a user can see in a report (e.g., by SalesRegion = “UserRegion”). Defined in the model with DAX filter expressions and applied by user roles.

8. How do you setup incremental refresh? 
• Mark your tables as “incrementally refreshable” in the model.
• Define a date/time column and ranges (e.g., last 3 years full, last 60 days incremental).
• Set refresh schedule in the Power BI service with gateways if needed.

9. What is the difference between filters vs slicers? 
• Filters: rules applied behind the scenes (e.g., in page/report level filters) that always apply.
• Slicers: interactive controls on the report canvas that users click to change what data is shown.

10. What is a data model? 
A data model is the structure in Power BI that holds tables, relationships, calculated columns, measures, and hierarchies, forming the semantic layer for reporting.

11. How do you publish and share reports? 
• Publish from Power BI Desktop to a workspace in Power BI Service.
• Share via apps, workspaces, or by granting access to specific users/groups; use RLS and sharing permissions to control who sees what.

12. What is Performance Analyzer tool? 
Performance Analyzer in Power BI Desktop records how long each visual takes to render and which DAX queries run, helping identify slow visuals or large queries.

13. How do you create month‑on‑month growth DAX? 
MoM Growth =
VAR CurrentSales = [Total Sales] 
VAR PreviousSales = CALCULATE([Total Sales], DATEADD('Date'[Date], -1, MONTH)) 
RETURN 
DIVIDE(CurrentSales - PreviousSales, PreviousSales)

14. How do you use custom visuals? 
Download a custom visual from the marketplace, add it to the report in Power BI Desktop or Service, then configure like a native visual (fields, formatting, interactivity).

15. What is gateway for refresh? 
An on‑premises gateway connects Power BI Service to data sources behind your firewall (e.g., SQL Server, file shares). It enables scheduled refresh for datasets that pull from those sources.

16. What is a .pbix file? 
A .pbix file is the Power BI Desktop project file that contains the report layout, queries, data model, and DAX logic. It can be opened in Power BI Desktop or published to the service.

17. What are quick measures examples? 
Quick measures are auto‑generated DAX calculations with a UI. Examples: 
• Average of a column.
  • ❤ 17
Post #2696 7.52K
𝗜𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄𝗲𝗿: You have 2 minutes to solve this SQL query.

Find the second highest salary in each department from the employees table, excluding any department with fewer than 2 employees.

𝗠𝗲: Challenge accepted!

SELECT 
department,
MAX(salary) AS second_highest_salary
FROM (
SELECT
department,
salary,
ROW_NUMBER() OVER (PARTITION BY department ORDER BY salary DESC) as rn
FROM employees
) ranked
WHERE rn = 2
GROUP BY department;


I used a subquery with ROW_NUMBER() window function partitioned by department to rank salaries in descending order within each department. The outer query then filters for rank 2 (second highest) and groups to get distinct departments. This demonstrates mastery of window functions, which are essential for advanced analytics and ranking problems.

𝗧𝗶𝗽 𝗳𝗼𝗿 𝗦𝗤𝗟 𝗝𝗼𝗯 𝗦𝗲𝗲𝗸𝗲𝗿𝘀:
Window functions like ROW_NUMBER(), RANK(), and DENSE_RANK() unlock complex ranking and analytics—practice them daily to ace behavioral and technical rounds!

React with ❤️ for more
  • ❤ 23
  • 👍 1
  • 👏 1
Post #2694 6.59K
17. What is a FULL OUTER JOIN? 
Returns all rows from both tables. If there's no match, unmatched sides are filled with NULL. Useful to see data that exists in either table but not in both.

18. How do you find duplicates across tables? 
Use INTERSECT or: 
SELECT t1.* 
FROM table1 t1 
WHERE EXISTS ( 
  SELECT 1 FROM table2 t2 
  WHERE t1.key = t2.key 
); 
Or use UNION ALL + GROUP BY to count occurrences.

19. What are SQL constraints? 
Rules that enforce data integrity: 
• PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK, DEFAULT.
They keep data consistent and help the query optimizer.

20. Explain GROUPING SETS. 
GROUPING SETS lets you define multiple grouping levels in one GROUP BY: 

GROUP BY GROUPING SETS ( 
  (),          -- grand total 
  (a),         -- by a 
  (b),         -- by b 
  (a, b)       -- by a and b 
); 
Useful for multi‑level summaries (like OLAP reports).

SQL Programming: https://whatsapp.com/channel/0029VanC5rODzgT6TiTGoa1v

Double Tap ❤️ For More
  • ❤ 13
  • 👏 1
Post #2692 8.34K
✅ 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 JOIN employees e2 ON e1.manager_id = e2.id; 
Useful for parent‑child relationships.

9. What is the difference between DELETE, DROP, and TRUNCATE? 
• DELETE: removes rows (can be filtered by WHERE), can be rolled back.
• TRUNCATE: removes all rows quickly, resets storage; often not logged per row.
• DROP: removes entire table (structure + data); cannot be rolled back.

10. How do you pivot/unpivot data in SQL? 
• Pivot: turns rows into columns (e.g., sales per month as columns) using PIVOT or conditional aggregation (MAX(CASE WHEN ... END)).
• Unpivot: turns columns into rows (e.g., multiple month columns → one month column) using UNPIVOT or UNION ALL/VALUES.

11. What is LAG() and LEAD()? 
• LAG(col, n): value of col from n rows before current row.
• LEAD(col, n): value from n rows after. Used for time‑series analysis (MoM change, prior/next values).

12. How do you handle NULL in aggregates? 
Most aggregates (SUM, AVG, MAX, MIN) ignore NULL. 
• COUNT(col) ignores NULL; COUNT(*) counts all rows.
• Use COALESCE() or ISNULL() to replace NULL before aggregating.

13. What is the difference between VIEW and MATERIALIZED VIEW? 
• VIEW: virtual table; query runs every time you select.
• MATERIALIZED VIEW: stores result physically and refreshes periodically; faster reads, slower updates.

14. Explain ACID properties. 
• Atomicity: transaction is "all or nothing".
• Consistency: valid state before and after.
• Isolation: concurrent transactions don't interfere.
• Durability: committed changes survive crashes.

15. How do you optimize a slow query? 
• Add proper indexes on WHERE, JOIN, ORDER BY columns.
• Remove unnecessary SELECT *, DISTINCT, or functions on indexed columns.
• Check execution plan and avoid large scans; use LIMIT or partitioning if possible.

16. What is the difference between INNER JOIN and EXISTS? 
• INNER JOIN: returns combined columns from both tables where keys match.
• EXISTS: checks if a subquery returns any rows; usually faster when you only care about existence (e.g., filtering with WHERE EXISTS).
  • ❤ 17
  • 👎 1
Post #2691 12K
✅ Top Data Analyst Interview Questions

✅ SQL
1. What is a window function?
2. What is the difference between RANK() and ROW_NUMBER()?
3. How do you find the second highest salary?
4. What is a recursive CTE?
5. What is the difference between correlated and non-correlated subquery?
6. How do you remove duplicates without DISTINCT?
7. What is an INDEX and when do you use it?
8. Explain self-join with example.
9. What is the difference between DELETE, DROP, and TRUNCATE?
10. How do you pivot/unpivot data in SQL?
11. What is LAG() and LEAD()?
12. How do you handle NULL in aggregates?
13. What is the difference between VIEW and MATERIALIZED VIEW?
14. Explain ACID properties.
15. How do you optimize a slow query?
16. What is the difference between INNER JOIN and EXISTS?
17. What is a FULL OUTER JOIN?
18. How do you find duplicates across tables?
19. What are SQL constraints?
20. Explain GROUPING SETS.

✅ Python
1. How do you handle missing data in Pandas?
2. What is the difference between loc[] and iloc[]?
3. What are lambda functions in data analysis?
4. How do you remove duplicates from DataFrame?
5. Explain groupby() and agg().
6. How do you merge/join DataFrames?
7. What is vectorization?
8. How do you handle outliers using IQR method?
9. What is the difference between list, tuple, dict?
10. How do you pivot data with pivot_table()?
11. What libraries do you use for viz (Matplotlib/Seaborn)?
12. Explain apply() vs map() vs applymap().
13. How do you read CSV with chunks?
14. What is NumPy broadcasting?
15. How do you handle time-series with Pandas (resample, shift)?
16. How do you calculate correlation matrix?
17. How do you optimize Pandas performance (e.g., dtype)?
18. What is the difference between Series vs DataFrame?
19. How do you filter DataFrame conditionally?
20. How do you rename columns efficiently?

✅ Power BI
1. What is DAX?
2. What is the difference between Power Query and Power Pivot?
3. What is the difference between measure vs calculated column?
4. Explain CALCULATE() function.
5. What are relationships (1:M, M:M)?
6. How do you handle many-to-many?
7. What is row-level security (RLS)?
8. How do you setup incremental refresh?
9. What is the difference between filters vs slicers?
10. What is a data model?
11. How do you publish and share reports?
12. What is performance analyzer tool?
13. How do you create month-on-month growth DAX?
14. How do you use custom visuals?
15. What is gateway for refresh?
16. What is a .pbix file?
17. What are quick measures examples?
18. What is data blending in Power BI?
19. How do you optimize large datasets?
20. What is Get Data?

✅ Excel
1. What is INDEX-MATCH combo?
2. How do you use Power Query?
3. What are dynamic arrays (FILTER, UNIQUE)?
4. What is SUMIFS vs SUMPRODUCT?
5. What is Power Pivot?
6. What are Goal Seek and Solver?
7. What are conditional formatting rules?
8. How do you remove duplicates advanced?
9. How do you create sparklines?
10. How do you use INDIRECT function?
11. What are data validation lists?
12. What are array formulas (Ctrl+Shift+Enter)?
13. What are Macros/VBA basics?
14. What are pivot table slicers?
15. What is what-if analysis?
16. What are TEXTJOIN and CONCAT?
17. What are XLOOKUP advantages?
18. What is Flash Fill feature?
19. What are Table vs Range pros?
20. How do you import from SQL/Web?

✅ Double Tap ❤️ For More
  • ❤ 63
  • 👍 1
Post #2689 11.9K
SQL Cheatsheet 📝

This SQL cheatsheet is designed to be your quick reference guide for SQL programming. Whether you’re a beginner learning how to query databases or an experienced developer looking for a handy resource, this cheatsheet covers essential SQL topics.

1. Database Basics
- CREATE DATABASE db_name;
- USE db_name;

2. Tables
- Create Table: CREATE TABLE table_name (col1 datatype, col2 datatype);
- Drop Table: DROP TABLE table_name;
- Alter Table: ALTER TABLE table_name ADD column_name datatype;

3. Insert Data
- INSERT INTO table_name (col1, col2) VALUES (val1, val2);

4. Select Queries
- Basic Select: SELECT * FROM table_name;
- Select Specific Columns: SELECT col1, col2 FROM table_name;
- Select with Condition: SELECT * FROM table_name WHERE condition;

5. Update Data
- UPDATE table_name SET col1 = value1 WHERE condition;

6. Delete Data
- DELETE FROM table_name WHERE condition;

7. Joins
- Inner Join: SELECT * FROM table1 INNER JOIN table2 ON table1.col = table2.col;
- Left Join: SELECT * FROM table1 LEFT JOIN table2 ON table1.col = table2.col;
- Right Join: SELECT * FROM table1 RIGHT JOIN table2 ON table1.col = table2.col;

8. Aggregations
- Count: SELECT COUNT(*) FROM table_name;
- Sum: SELECT SUM(col) FROM table_name;
- Group By: SELECT col, COUNT(*) FROM table_name GROUP BY col;

9. Sorting & Limiting
- Order By: SELECT * FROM table_name ORDER BY col ASC|DESC;
- Limit Results: SELECT * FROM table_name LIMIT n;

10. Indexes
- Create Index: CREATE INDEX idx_name ON table_name (col);
- Drop Index: DROP INDEX idx_name;

11. Subqueries
- SELECT * FROM table_name WHERE col IN (SELECT col FROM other_table);

12. Views
- Create View: CREATE VIEW view_name AS SELECT * FROM table_name;
- Drop View: DROP VIEW view_name;
  • ❤ 19
  • 👍 3
Post #2687 10.1K
Real‑world Data Analytics Questions with Answers 🔥

Let’s practice end‑to‑end data thinking using this small dataset.

📊 Dataset: customer_orders
| order_id | customer_id | product | category | quantity | unit_price | order_date |
|----------|-------------|---------------|------------|----------|------------|-------------|
| 1 | 1001 | Laptop | Electronics| 2 | 75000 | 2025‑01‑10 |
| 2 | 1002 | Mouse | Electronics| 10 | 1500 | 2025‑01‑12 |
| 3 | 1003 | Chair | Furniture | 5 | 8000 | 2025‑01‑15 |
| 4 | 1001 | Keyboard | Electronics| 8 | 2500 | 2025‑01‑11 |
| 5 | 1004 | Desk | Furniture | 3 | 15000 | 2025‑01‑18 |
| 6 | 1002 | Monitor | Electronics| 4 | 25000 | 2025‑01‑20 |
| 7 | 1005 | Table | Furniture | 6 | 5000 | 2025‑01‑22 |
| 8 | 1003 | Webcam | Electronics| 12 | 3000 | 2025‑01‑14 |

1. Define what “data analysis” means in this context
• Data analysis means transforming raw orders into insights: what sells most, who the best customers are, and how revenue changes over time.
• You’d use SQL to query, Excel/Python to clean, and Power BI to visualize.

2. What are the key metrics you’d track for this business?
• Revenue = quantity × unit_price
• Order count and average order value (AOV)
• Top‑selling categories and best customers by revenue

3. Write a SQL query for total revenue by category
SELECT 
category,
SUM(quantity * unit_price) AS total_revenue
FROM customer_orders
GROUP BY category;


4. How would you find repeat customers?
SELECT 
customer_id,
COUNT(order_id) AS order_count,
SUM(quantity * unit_price) AS total_spent
FROM customer_orders
GROUP BY customer_id
HAVING COUNT(order_id) > 1;

• Customers with order_count > 1 are repeat buyers.

5. How would you detect “top customers”?
• Define “top” by total_spent or average order value:
– SUM(revenue) / COUNT(orders)
• Use Power BI/Excel to sort descending and highlight top 10%.

6. What would an outlier analysis look like?
• Compute min, max, average, standard deviation of revenue per order.
• Flag orders where:
– revenue > average + 2 * standard_deviation
• Check if such orders are errors or real big deals (e.g., enterprise purchase).

7. How would you report month‑on‑month growth?
• In SQL/Power BI:
– Group by YEAR(order_date) and MONTH(order_date)
– Compute revenue per month
– Then calculate:
▪ MoM % = (CurrentMonthRevenue − PreviousMonthRevenue) / PreviousMonthRevenue

8. How would you turn this into a dashboard?
• Page 1 – Overview: Cards for total revenue, total orders, AOV.
• Page 2 – Trends: Line chart for MoM revenue, bar chart for category split.
• Page 3 – Customers: Table for top 10 customers and repeat customers.

9. How would you handle dirty data (nulls, duplicates)?
• Pre‑check:
– COUNT(*) vs COUNT(customer_id) to spot missing customers.
• Clean:
– Drop or impute missing critical fields.
– Remove duplicate orders using DISTINCT or ROW_NUMBER().

10. How would you explain your findings to a non‑tech manager?
• Use simple language + visuals:
– “Our top product category is Electronics, contributing X% of revenue.”
– “N top customers account for M% of total sales.”
• Avoid formulas; focus on business impact: retention, profitability, growth.

Double Tap ❤️ For More!
  • ❤ 13
Post #2685 8.37K
Here's a concise cheat sheet to help you get started with Python for Data Analytics. This guide covers essential libraries and functions that you'll frequently use.


1. Python Basics
- Variables:
x = 10
y = "Hello"

- Data Types:
  - Integers: x = 10
  - Floats: y = 3.14
  - Strings: name = "Alice"
  - Lists: my_list = [1, 2, 3]
  - Dictionaries: my_dict = {"key": "value"}
  - Tuples: my_tuple = (1, 2, 3)

- Control Structures:
  - if, elif, else statements
  - Loops: 
  
    for i in range(5):
        print(i)
   

  - While loop:
  
    while x < 5:
        print(x)
        x += 1
   

2. Importing Libraries

- NumPy:
  import numpy as np
 

- Pandas:
  import pandas as pd
 

- Matplotlib:
  import matplotlib.pyplot as plt
 

- Seaborn:
  import seaborn as sns
 

3. NumPy for Numerical Data

- Creating Arrays:
  arr = np.array([1, 2, 3, 4])
 

- Array Operations:
  arr.sum()
  arr.mean()
 

- Reshaping Arrays:
  arr.reshape((2, 2))
 

- Indexing and Slicing:
  arr[0:2]  # First two elements
 

4. Pandas for Data Manipulation

- Creating DataFrames:
  df = pd.DataFrame({
      'col1': [1, 2, 3],
      'col2': ['A', 'B', 'C']
  })
 

- Reading Data:
  df = pd.read_csv('file.csv')
 

- Basic Operations:
  df.head()          # First 5 rows
  df.describe()      # Summary statistics
  df.info()          # DataFrame info
 

- Selecting Columns:
  df['col1']
  df[['col1', 'col2']]
 

- Filtering Data:
  df[df['col1'] > 2]
 

- Handling Missing Data:
  df.dropna()        # Drop missing values
  df.fillna(0)       # Replace missing values
 

- GroupBy:
  df.groupby('col2').mean()
 

5. Data Visualization

- Matplotlib:
  plt.plot(df['col1'], df['col2'])
  plt.xlabel('X-axis')
  plt.ylabel('Y-axis')
  plt.title('Title')
  plt.show()
 

- Seaborn:
  sns.histplot(df['col1'])
  sns.boxplot(x='col1', y='col2', data=df)
 

6. Common Data Operations

- Merging DataFrames:
  pd.merge(df1, df2, on='key')
 

- Pivot Table:
  df.pivot_table(index='col1', columns='col2', values='col3')
 

- Applying Functions:
  df['col1'].apply(lambda x: x*2)
 

7. Basic Statistics

- Descriptive Stats:
  df['col1'].mean()
  df['col1'].median()
  df['col1'].std()
 

- Correlation:
  df.corr()
 

This cheat sheet should give you a solid foundation in Python for data analytics. As you get more comfortable, you can delve deeper into each library's documentation for more advanced features.

I have curated the best resources to learn Python 👇👇
https://whatsapp.com/channel/0029VaiM08SDuMRaGKd9Wv0L

Hope you'll like it

Like this post if you need more resources like this 👍❤️
  • ❤ 22
  • 👍 1
  • 🔥 1
Post #2683 8.13K
Real-world SQL Questions with Answers 🔥

Let's dive into some real-world SQL questions with a mini dataset.

📊 Dataset: employees
id  name    department  salary  manager_id
1 Aditi HR 30000 5
2 Rahul IT 50000 6
3 Neha IT 60000 6
4 Aman Sales 40000 7
5 Kiran HR 70000 NULL
6 Mohit IT 80000 NULL
7 Suresh Sales 65000 NULL
8 Pooja HR 30000 5


1. Find average salary per department
SELECT department, AVG(salary) AS avg_salary 
FROM employees
GROUP BY department;


2. Find employees earning above department average
SELECT name, department, salary 
FROM employees e
WHERE salary > (
SELECT AVG(salary)
FROM employees
WHERE department = e.department
);


3. Find highest salary in each department
SELECT department, MAX(salary) AS max_salary 
FROM employees
GROUP BY department;


4. Find employees who earn more than their manager
SELECT e.name 
FROM employees e
JOIN employees m ON e.manager_id = m.id
WHERE e.salary > m.salary;


5. Count employees in each department
SELECT department, COUNT(*) AS total_employees 
FROM employees
GROUP BY department;


6. Find departments with more than 2 employees
SELECT department, COUNT(*) AS total 
FROM employees
GROUP BY department
HAVING COUNT(*) > 2;


7. Find second highest salary
SELECT MAX(salary) 
FROM employees
WHERE salary < (SELECT MAX(salary) FROM employees);


8. Find employees without managers
SELECT name 
FROM employees
WHERE manager_id IS NULL;


9. Rank employees by salary
SELECT name, salary, RANK() OVER (ORDER BY salary DESC) AS rank 
FROM employees;


10. Find duplicate salaries
SELECT salary, COUNT(*) 
FROM employees
GROUP BY salary
HAVING COUNT(*) > 1;


11. Top 2 highest salaries
SELECT DISTINCT salary 
FROM employees
ORDER BY salary DESC
LIMIT 2;


Double Tap ❤️ For More
  • ❤ 51
  • 👍 3
  • 👏 1
Post #2682 7.22K
Scenario based  Interview Questions & Answers for Data Analyst

1. Scenario: You are working on a SQL database that stores customer information. The database has a table called "Orders" that contains order details. Your task is to write a SQL query to retrieve the total number of orders placed by each customer.
  Question:
  - Write a SQL query to find the total number of orders placed by each customer.
Expected Answer:
    SELECT CustomerID, COUNT(*) AS TotalOrders
    FROM Orders
    GROUP BY CustomerID;

2. Scenario: You are working on a SQL database that stores employee information. The database has a table called "Employees" that contains employee details. Your task is to write a SQL query to retrieve the names of all employees who have been with the company for more than 5 years.
  Question:
  - Write a SQL query to find the names of employees who have been with the company for more than 5 years.
Expected Answer:
    SELECT Name
    FROM Employees
    WHERE DATEDIFF(year, HireDate, GETDATE()) > 5;

Power BI Scenario-Based Questions

1. Scenario: You have been given a dataset in Power BI that contains sales data for a company. Your task is to create a report that shows the total sales by product category and region.
    Expected Answer:
    - Load the dataset into Power BI.
    - Create relationships if necessary.
    - Use the "Fields" pane to select the necessary fields (Product Category, Region, Sales).
    - Drag these fields into the "Values" area of a new visualization (e.g., a table or bar chart).
    - Use the "Filters" pane to filter data as needed.
    - Format the visualization to enhance clarity and readability.

2. Scenario: You have been asked to create a Power BI dashboard that displays real-time stock prices for a set of companies. The stock prices are available through an API.
  Expected Answer:
    - Use Power BI Desktop to connect to the API.
    - Go to "Get Data" > "Web" and enter the API URL.
    - Configure the data refresh settings to ensure real-time updates (e.g., setting up a scheduled refresh or using DirectQuery if supported).
    - Create visualizations using the imported data.
    - Publish the report to the Power BI service and set up a data gateway if needed for continuous refresh.

3. Scenario: You have been given a Power BI report that contains multiple visualizations. The report is taking a long time to load and is impacting the performance of the application.
    Expected Answer:
    - Analyze the current performance using Performance Analyzer.
    - Optimize data model by reducing the number of columns and rows, and removing unnecessary calculations.
    - Use aggregated tables to pre-compute results.
    - Simplify DAX calculations.
    - Optimize visualizations by reducing the number of visuals per page and avoiding complex custom visuals.
    - Ensure proper indexing on the data source.

Free SQL Resources: https://whatsapp.com/channel/0029VanC5rODzgT6TiTGoa1v

Like if you need more similar content

Hope it helps :)
  • ❤ 21
  • 👍 1
Post #2679 10.4K
  • ❤ 2
  • 👏 1
Older posts →
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 →