Data Analytics
Perfect channel to learn Data Analytics Learn SQL, Python, Alteryx, Tableau, Power BI and many more For Promotions: @coderfun @love_data
Show more📈 Analytical overview of Telegram channel Data Analytics
Channel Data Analytics (@sqlspecialist) in the English language segment is an active participant. Currently, the community unites 110 851 subscribers, ranking 1 072 in the Technologies & Applications category and 2 226 in the India region.
📊 Audience metrics and dynamics
Since its creation on невідомо, the project has demonstrated rapid growth, gathering an audience of 110 851 subscribers.
According to the latest data from 02 September, 2026, the channel demonstrates stable activity. Although there has been a change in the number of participants by 198 over the last 30 days and by 20 over the last 24 hours, overall reach remains high.
- Verification status: Not verified
- Engagement rate (ER): The average audience engagement rate is 2.82%. Within the first 24 hours after publication, content typically collects 1.21% reactions from the total number of subscribers.
- Post reach: On average, each post receives 3 130 views. Within the first day, a publication typically gains 1 336 views.
- Reactions and interaction: The audience actively supports content: the average number of reactions per post is 7.
- Thematic interests: Content is focused on key topics such as row, sql, analytic, analyst, visualization.
📝 Description and content policy
The author describes the resource as a platform for expressing subjective opinions:
“Perfect channel to learn Data Analytics
Learn SQL, Python, Alteryx, Tableau, Power BI and many more
For Promotions: @coderfun @love_data”
Thanks to the high frequency of updates (latest data received on 03 September, 2026), the channel maintains relevance and a high level of publication reach. Analytics show that the audience actively interacts with content, making it an important point of influence in the Technologies & Applications category.
"What are total sales for each region?"You need to divide the data into groups. That's what GROUP BY does. 1️⃣1️⃣ Basic GROUP BY Suppose: North: 50,000 and 70,000 → Total 120,000 South: 40,000 and 60,000 → Total 100,000 West: 80,000 → Total 80,000 Query:
SELECT
Region,
SUM(Sales) AS Total_Sales
FROM Orders
GROUP BY Region;
Result:
North = 120,000, South = 100,000, West = 80,000
Now you've answered:
"How much did each region sell?"1️⃣2️⃣ GROUP BY Department Suppose you have: John - IT - 75,000 Sarah - HR - 60,000 Mike - IT - 82,000 David - Finance - 90,000 Alice - HR - 65,000 Query:
SELECT
Department,
AVG(Salary) AS Average_Salary
FROM Employees
GROUP BY Department;
Result:
Finance: 90,000, HR: 62,500, IT: 78,500
1️⃣3️⃣ GROUP BY with COUNT()
Question:
How many employees are in each department?
SELECT
Department,
COUNT(*) AS Employee_Count
FROM Employees
GROUP BY Department;
Result:
IT: 2, HR: 2, Finance: 1
1️⃣4️⃣ GROUP BY with Multiple Columns
You can group by more than one column.
Suppose your sales data contains:
North Electronics: 80,000
North Furniture: 40,000
South Electronics: 70,000
South Furniture: 50,000
Query:
SELECT
Region,
Category,
SUM(Sales) AS Total_Sales
FROM Orders
GROUP BY Region, Category;
Result:
North Electronics = 80,000, North Furniture = 40,000, South Electronics = 70,000, South Furniture = 50,000
This lets you analyze combinations of dimensions.
1️⃣5️⃣ GROUP BY vs PivotTable
This is an important connection.
In Excel:
Region → Rows
Sales → Values
In SQL:
SELECT
Region,
SUM(Sales)
FROM Orders
GROUP BY Region;
The analytical concept is very similar.
You're grouping records and calculating an aggregate.
1️⃣6️⃣ HAVING
Now suppose you want:
"Show only regions where total sales are greater than ₹100,000."You can't simply use WHERE on the aggregate result. You use: HAVING
SELECT
Region,
SUM(Sales) AS Total_Sales
FROM Orders
GROUP BY Region
HAVING SUM(Sales) > 100000;
Result:
North = 120,000
1️⃣7️⃣ WHERE vs HAVING
This is a very common SQL interview question.
WHERE
Filters individual rows before grouping.
Example:
SELECT *
FROM Orders
WHERE Region = 'North';
HAVING
Filters groups after aggregation.
Example:
SELECT
Region,
SUM(Sales) AS Total_Sales
FROM Orders
GROUP BY Region
HAVING SUM(Sales) > 100000;
Remember:
WHERE → Filter rows HAVING → Filter groups1️⃣8️⃣ WHERE + GROUP BY + HAVING You can use all three. Question:
Find regions where 2026 sales exceed ₹100,000.Conceptually:
SELECT
Region,
SUM(Sales) AS Total_Sales
FROM Orders
WHERE Order_Date >= '2026-01-01'
AND Order_Date < '2027-01-01'
GROUP BY Region
HAVING SUM(Sales) > 100000;SELECT
Region,
SUM(Sales) AS Total_Sales
FROM Orders
GROUP BY Region
ORDER BY Total_Sales DESC;
Result:
North: 500,000, South: 350,000, West: 200,000, East: 150,000
2️⃣0️⃣ Top 3 Regions
You can combine:
GROUP BY + ORDER BY + LIMIT
For example, in PostgreSQL/MySQL:
SELECT
Region,
SUM(Sales) AS Total_Sales
FROM Orders
GROUP BY Region
ORDER BY Total_Sales DESC
LIMIT 3;
This answers:
"Which three regions generated the most sales?"2️⃣1️⃣ GROUP BY Dates Suppose you have: Order_Date and Sales You might want:
Total sales by year.The exact date function varies by database system. For example, in PostgreSQL:
SELECT
EXTRACT(YEAR FROM Order_Date) AS Sales_Year,
SUM(Sales) AS Total_Sales
FROM Orders
GROUP BY EXTRACT(YEAR FROM Order_Date)
ORDER BY Sales_Year;
Result:
2024: 8,500,000, 2025: 10,200,000, 2026: 12,400,000
2️⃣2️⃣ Grouping by Month
In PostgreSQL, you can use:
SELECT
DATE_TRUNC('month', Order_Date) AS Sales_Month,
SUM(Sales) AS Total_Sales
FROM Orders
GROUP BY DATE_TRUNC('month', Order_Date)
ORDER BY Sales_Month;
This creates monthly sales totals.
Different SQL platforms have different date functions, so always check the database you're working with.
2️⃣3️⃣ Calculate Average Order Value
A common business KPI is:
Average Order Value (AOV)
A simple version is:
SELECT
SUM(Sales) / COUNT(*) AS Average_Order_Value
FROM Orders;
If each row represents exactly one order.
If the table can contain multiple rows per order, however, you need to calculate the denominator based on distinct orders:
SELECT
SUM(Sales) / COUNT(DISTINCT Order_ID) AS Average_Order_Value
FROM Orders;
This distinction is extremely important.
2️⃣4️⃣ COUNT(DISTINCT) in Real Analytics
Suppose a customer places multiple orders:
Customer 101 → Orders 5001, 5002
Customer 102 → Order 5003
Customer 103 → Orders 5004, 5005
Total orders: 5
Unique customers: 3
Query:
SELECT COUNT(DISTINCT Customer_ID) AS Unique_Customers
FROM Orders;
Result: 3
This is commonly used for metrics such as:
Active customers
Unique users
Unique accounts
Distinct orders
Distinct products
2️⃣5️⃣ Conditional Aggregation
One powerful technique is combining CASE WHEN with aggregate functions.
For example:
Count how many orders were above ₹50,000.
SELECT
SUM(
CASE
WHEN Sales > 50000 THEN 1
ELSE 0
END
) AS High_Value_Orders
FROM Orders;
This allows you to create customized metrics.
You'll use this technique much more in advanced SQL.
2️⃣6️⃣ Common SQL Analytical Pattern
A very common query structure is:
SELECT
Dimension,
AGGREGATE_FUNCTION(Metric) AS KPI
FROM Table
WHERE Condition
GROUP BY Dimension
HAVING Aggregate_Condition
ORDER BY KPI DESC;
For example:
SELECT
Region,
SUM(Sales) AS Total_Sales
FROM Orders
WHERE Order_Date >= '2026-01-01'
GROUP BY Region
HAVING SUM(Sales) > 100000
ORDER BY Total_Sales DESC;What is the total sales by region? What is the average salary by department? How many customers are in each city? Which products generated more than ₹10 lakh in sales?To answer these questions, you need: Aggregate Functions + GROUP BY + HAVING 1️⃣ What Are Aggregate Functions? Aggregate functions perform calculations across multiple rows and return a summarized result. The most important ones are: SUM() COUNT() AVG() MIN() MAX() Think of them as the SQL equivalent of the basic Excel functions you learned earlier. 2️⃣ SUM() SUM() calculates the total of a numeric column. Suppose you have: Order_ID: 1001, Sales: 50,000 Order_ID: 1002, Sales: 70,000 Order_ID: 1003, Sales: 30,000 Query:
SELECT SUM(Sales) AS Total_Sales
FROM Orders;
Result:
Total_Sales = 150,000
Business question
What is our total revenue?Answer → SUM() 3️⃣ COUNT() COUNT() counts records.
SELECT COUNT(*) AS Total_Orders
FROM Orders;
If there are 10,000 orders:
Total_Orders = 10,000
Why COUNT(*)?
COUNT(*) counts rows.
This is often useful when you want the total number of records.
4️⃣ COUNT(Column)
You can also count values in a specific column.
SELECT COUNT(Customer_ID) AS Customer_Count
FROM Orders;
One important distinction:
COUNT(column) generally doesn't count NULL values.
Whereas:
COUNT(*)
counts rows regardless of whether individual columns contain NULLs.
5️⃣ COUNT(DISTINCT)
Suppose your Orders table contains:
Order 1001 → Customer 101
Order 1002 → Customer 102
Order 1003 → Customer 101
Order 1004 → Customer 103
There are:
4 orders
but only:
3 unique customers
Use:
SELECT COUNT(DISTINCT Customer_ID) AS Unique_Customers
FROM Orders;
Result:
3
This is extremely important in analytics.
6️⃣ AVG()
AVG() calculates the average.
Suppose salaries are:
50,000, 60,000, 70,000
Query:
SELECT AVG(Salary) AS Average_Salary
FROM Employees;
Result:
60,000
Business questions
What is the average order value? What is the average employee salary? What is the average product price?Answer → AVG() 7️⃣ MIN() MIN() returns the smallest value.
SELECT MIN(Salary) AS Minimum_Salary
FROM Employees;
Example result:
35,000
Useful for:
Minimum salary
Lowest sales
Earliest date
Lowest transaction value
8️⃣ MAX()
MAX() returns the largest value.
SELECT MAX(Salary) AS Maximum_Salary
FROM Employees;
Result:
150,000
Useful for:
Highest salary
Highest sales
Largest transaction
Latest date
9️⃣ Using Multiple Aggregate Functions
You can use several aggregate functions in one query.
SELECT
SUM(Sales) AS Total_Sales,
AVG(Sales) AS Average_Sales,
MIN(Sales) AS Minimum_Sales,
MAX(Sales) AS Maximum_Sales,
COUNT(*) AS Total_Orders
FROM Orders;Any number of characters.So this could match: • John • James • Jennifer 2️⃣3️⃣ LIKE with Wildcards • Starts with J LIKE 'J%' • Ends with n LIKE '%n' • Contains "oh" LIKE '%oh%' Wildcards are extremely useful when searching text data. 2️⃣4️⃣ DISTINCT DISTINCT removes duplicate values from the result. Suppose your employee table contains: • IT • HR • IT • Finance • HR • IT Use: SELECT DISTINCT Department FROM Employees; Result: IT HR Finance This is useful for discovering categories in a dataset. 2️⃣5️⃣ ORDER BY ORDER BY sorts your results. Suppose you want employees with the highest salary first. SELECT * FROM Employees ORDER BY Salary DESC; DESC means: Descending Highest → Lowest 2️⃣6️⃣ ASC ASC means ascending. SELECT * FROM Employees ORDER BY Salary ASC; Lowest → Highest Ascending is generally the default sort direction. 2️⃣7️⃣ LIMIT / TOP The syntax depends on the database system. In systems such as PostgreSQL and MySQL: SELECT * FROM Employees ORDER BY Salary DESC LIMIT 5; This returns the top 5 employees by salary. In SQL Server, you would commonly use: SELECT TOP 5 * FROM Employees ORDER BY Salary DESC; This is an important point:
SQL is a language, but different database systems have slightly different syntax.2️⃣8️⃣ Aliases Aliases give columns or tables temporary names within a query. For example: SELECT Name AS Employee_Name, Salary AS Annual_Salary FROM Employees; The result displays: Employee_Name Annual_Salary John 75,000 Sarah 60,000 Aliases make results easier to understand. 2️⃣9️⃣ SQL Comments You can add comments to explain your queries. For example: -- Get employees earning more than 70,000 SELECT Name, Salary FROM Employees WHERE Salary > 70000; Comments don't affect the query result. They're useful when queries become complex. 🧪 Practical Interview Challenge Suppose you have: Employees ID Name Department Salary 101 John IT 75,000 102 Sarah HR 60,000 103 Mike Finance 82,000 104 David IT 90,000 105 Alice HR 65,000 Q1. Retrieve all employees. SELECT * FROM Employees; Q2. Retrieve only names and salaries. SELECT Name, Salary FROM Employees; Q3. Find employees earning more than ₹70,000. SELECT * FROM Employees WHERE Salary > 70000; Q4. Find IT employees. SELECT * FROM Employees WHERE Department = 'IT'; Q5. Find IT or Finance employees. SELECT * FROM Employees WHERE Department IN ('IT', 'Finance'); Q6. Sort employees by salary from highest to lowest. SELECT * FROM Employees ORDER BY Salary DESC; Q7. Find the top 3 highest-paid employees. PostgreSQL/MySQL: SELECT * FROM Employees ORDER BY Salary DESC LIMIT 3; SQL Server: SELECT TOP 3 * FROM Employees ORDER BY Salary DESC; Q8. List unique departments. SELECT DISTINCT Department FROM Employees; 🏆 Double Tap ❤️ For More
Return all columns from the Customers table.Let me break it down. SELECT: Specifies what you want to retrieve. FROM: Specifies the table. Customers: The table you're querying. 1️⃣1️⃣ SELECT SELECT is one of the first SQL commands you need to learn. Suppose you have: Employees Employee_ID Name Department Salary 101 John IT 75,000 102 Sarah HR 60,000 103 Mike Finance 82,000 To retrieve all columns: SELECT * FROM Employees; 1️⃣2️⃣ Selecting Specific Columns You don't always need every column. Suppose you only want: Name and Department Use: SELECT Name, Department FROM Employees; Result: Name Department John IT Sarah HR Mike Finance This is generally better than using SELECT * when you only need specific fields. 1️⃣3️⃣ Why Avoid SELECT * in Production Queries? You may see beginners writing: SELECT * FROM Employees; all the time. It's useful while learning and exploring data. But in production queries, explicitly selecting the required columns is often better because: • It makes the query clearer • It avoids retrieving unnecessary data • It can reduce data transfer • It makes downstream dependencies more predictable For example: SELECT Employee_ID, Name, Salary FROM Employees; is more intentional. 1️⃣4️⃣ WHERE WHERE filters records. Suppose you want employees from IT. SELECT * FROM Employees WHERE Department = 'IT'; Result: Employee_ID Name Department Salary 101 John IT 75,000 The database only returns records satisfying the condition. 1️⃣5️⃣ Filtering Numeric Values Suppose you want employees earning more than ₹70,000. SELECT * FROM Employees WHERE Salary > 70000; Result: Employee_ID Name Department Salary 101 John IT 75,000 103 Mike Finance 82,000 1️⃣6️⃣ Comparison Operators You should know these operators: Operator Meaning = Equal to <> Not equal to
Greater than < Less than = Greater than or equal <= Less than or equalExamples: WHERE Salary >= 80000 WHERE Department <> 'HR' 1️⃣7️⃣ AND AND requires all conditions to be true. Suppose you want: IT employees earning more than ₹70,000. SELECT * FROM Employees WHERE Department = 'IT' AND Salary > 70000; The record must satisfy both conditions. Think: IT AND Salary > 70,000 1️⃣8️⃣ OR OR requires at least one condition to be true. Suppose you want: IT or Finance employees.
"Give me all sales from the North region."Or:
"What was total revenue last month?"Or:
"Which 10 products generated the most revenue?"SQL allows you to ask these questions directly. 2️⃣ Why Is SQL Important for Data Analysts? Imagine a company has: 50 million transactions. Excel isn't the right tool for storing and querying all that information. The data may be stored in a database such as: • PostgreSQL • MySQL • Microsoft SQL Server • Oracle Database • Snowflake • BigQuery As a Data Analyst, you may connect to the database and use SQL to extract the data you need. A typical workflow looks like: Database ↓ SQL Query ↓ Required Data ↓ Analysis ↓ Dashboard / Report ↓ Business Decision 3️⃣ What Is a Database? A database is a system used to store and manage data. For example, an e-commerce company might have: • Customers • Products • Orders • Payments • Employees Each represents a different type of information. Instead of putting everything into one enormous table, relational databases typically organize related information into separate tables. 4️⃣ What Is a Table? A table is a structured collection of data organized into: Rows + Columns For example: Customers Customer_ID Customer_Name City 101 John Mumbai 102 Sarah Pune 103 Mike Delhi Each row represents one customer. Each column represents an attribute. This should look familiar from Excel. 5️⃣ Rows vs Columns Just like Excel: Row Represents a record. Example: 101 | John | Mumbai represents one customer. Column Represents an attribute. For example: • Customer_ID • Customer_Name • City A useful rule:
One row = one record One column = one attribute6️⃣ What Is a Primary Key? A Primary Key uniquely identifies each record in a table. For example: Customer_ID Customer_Name 101 John 102 Sarah 103 Mike Here: Customer_ID can be the primary key. Each customer should have a unique ID. 101 → John 102 → Sarah 103 → Mike You shouldn't have two different customers with the same primary key. 7️⃣ What Is a Foreign Key? A Foreign Key is a column used to establish a relationship between tables. Suppose: Customers Customer_ID Customer_Name 101 John 102 Sarah Orders Order_ID Customer_ID Sales 5001 101 50,000 5002 102 70,000 5003 101 30,000 Here: Customers.Customer_ID is the primary key. Orders.Customer_ID can be a foreign key.
Any number of characters.So this could match: • John • James • Jennifer 2️⃣3️⃣ LIKE with Wildcards • Starts with J LIKE 'J%' • Ends with n LIKE '%n' • Contains "oh" LIKE '%oh%' Wildcards are extremely useful when searching text data. 2️⃣4️⃣ DISTINCT DISTINCT removes duplicate values from the result. Suppose your employee table contains: • IT • HR • IT • Finance • HR • IT Use: SELECT DISTINCT Department FROM Employees; Result: IT HR Finance This is useful for discovering categories in a dataset. 2️⃣5️⃣ ORDER BY ORDER BY sorts your results. Suppose you want employees with the highest salary first. SELECT * FROM Employees ORDER BY Salary DESC; DESC means: Descending Highest → Lowest 2️⃣6️⃣ ASC ASC means ascending. SELECT * FROM Employees ORDER BY Salary ASC; Lowest → Highest Ascending is generally the default sort direction. 2️⃣7️⃣ LIMIT / TOP The syntax depends on the database system. In systems such as PostgreSQL and MySQL: SELECT * FROM Employees ORDER BY Salary DESC LIMIT 5; This returns the top 5 employees by salary. In SQL Server, you would commonly use: SELECT TOP 5 * FROM Employees ORDER BY Salary DESC; This is an important point:
SQL is a language, but different database systems have slightly different syntax.2️⃣8️⃣ Aliases Aliases give columns or tables temporary names within a query. For example: SELECT Name AS Employee_Name, Salary AS Annual_Salary FROM Employees; The result displays: Employee_Name Annual_Salary John 75,000 Sarah 60,000 Aliases make results easier to understand. 2️⃣9️⃣ SQL Comments You can add comments to explain your queries. For example: -- Get employees earning more than 70,000 SELECT Name, Salary FROM Employees WHERE Salary > 70000; Comments don't affect the query result. They're useful when queries become complex. 🧪 Practical Interview Challenge Suppose you have: Employees ID Name Department Salary 101 John IT 75,000 102 Sarah HR 60,000 103 Mike Finance 82,000 104 David IT 90,000 105 Alice HR 65,000 Q1. Retrieve all employees. SELECT * FROM Employees; Q2. Retrieve only names and salaries. SELECT Name, Salary FROM Employees; Q3. Find employees earning more than ₹70,000. SELECT * FROM Employees WHERE Salary > 70000; Q4. Find IT employees. SELECT * FROM Employees WHERE Department = 'IT'; Q5. Find IT or Finance employees. SELECT * FROM Employees WHERE Department IN ('IT', 'Finance'); Q6. Sort employees by salary from highest to lowest. SELECT * FROM Employees ORDER BY Salary DESC; Q7. Find the top 3 highest-paid employees. PostgreSQL/MySQL: SELECT * FROM Employees ORDER BY Salary DESC LIMIT 3; SQL Server: SELECT TOP 3 * FROM Employees ORDER BY Salary DESC; Q8. List unique departments. SELECT DISTINCT Department FROM Employees; 🏆 Double Tap ❤️ For More ----- 1.59 ₽ · /balance_help
Return all columns from the Customers table.Let me break it down. SELECT: Specifies what you want to retrieve. FROM: Specifies the table. Customers: The table you're querying. 1️⃣1️⃣ SELECT SELECT is one of the first SQL commands you need to learn. Suppose you have: Employees Employee_ID Name Department Salary 101 John IT 75,000 102 Sarah HR 60,000 103 Mike Finance 82,000 To retrieve all columns: SELECT * FROM Employees; 1️⃣2️⃣ Selecting Specific Columns You don't always need every column. Suppose you only want: Name and Department Use: SELECT Name, Department FROM Employees; Result: Name Department John IT Sarah HR Mike Finance This is generally better than using SELECT * when you only need specific fields. 1️⃣3️⃣ Why Avoid SELECT * in Production Queries? You may see beginners writing: SELECT * FROM Employees; all the time. It's useful while learning and exploring data. But in production queries, explicitly selecting the required columns is often better because: • It makes the query clearer • It avoids retrieving unnecessary data • It can reduce data transfer • It makes downstream dependencies more predictable For example: SELECT Employee_ID, Name, Salary FROM Employees; is more intentional. 1️⃣4️⃣ WHERE WHERE filters records. Suppose you want employees from IT. SELECT * FROM Employees WHERE Department = 'IT'; Result: Employee_ID Name Department Salary 101 John IT 75,000 The database only returns records satisfying the condition. 1️⃣5️⃣ Filtering Numeric Values Suppose you want employees earning more than ₹70,000. SELECT * FROM Employees WHERE Salary > 70000; Result: Employee_ID Name Department Salary 101 John IT 75,000 103 Mike Finance 82,000 1️⃣6️⃣ Comparison Operators You should know these operators: Operator Meaning = Equal to <> Not equal to
Greater than < Less than = Greater than or equal <= Less than or equalExamples: WHERE Salary >= 80000 WHERE Department <> 'HR' 1️⃣7️⃣ AND AND requires all conditions to be true. Suppose you want: IT employees earning more than ₹70,000. SELECT * FROM Employees WHERE Department = 'IT' AND Salary > 70000; The record must satisfy both conditions. Think: IT AND Salary > 70,000 1️⃣8️⃣ OR OR requires at least one condition to be true. Suppose you want: IT or Finance employees.
"Give me all sales from the North region."Or:
"What was total revenue last month?"Or:
"Which 10 products generated the most revenue?"SQL allows you to ask these questions directly. 2️⃣ Why Is SQL Important for Data Analysts? Imagine a company has: 50 million transactions. Excel isn't the right tool for storing and querying all that information. The data may be stored in a database such as: • PostgreSQL • MySQL • Microsoft SQL Server • Oracle Database • Snowflake • BigQuery As a Data Analyst, you may connect to the database and use SQL to extract the data you need. A typical workflow looks like: Database ↓ SQL Query ↓ Required Data ↓ Analysis ↓ Dashboard / Report ↓ Business Decision 3️⃣ What Is a Database? A database is a system used to store and manage data. For example, an e-commerce company might have: • Customers • Products • Orders • Payments • Employees Each represents a different type of information. Instead of putting everything into one enormous table, relational databases typically organize related information into separate tables. 4️⃣ What Is a Table? A table is a structured collection of data organized into: Rows + Columns For example: Customers Customer_ID Customer_Name City 101 John Mumbai 102 Sarah Pune 103 Mike Delhi Each row represents one customer. Each column represents an attribute. This should look familiar from Excel. 5️⃣ Rows vs Columns Just like Excel: Row Represents a record. Example: 101 | John | Mumbai represents one customer. Column Represents an attribute. For example: • Customer_ID • Customer_Name • City A useful rule:
One row = one record One column = one attribute6️⃣ What Is a Primary Key? A Primary Key uniquely identifies each record in a table. For example: Customer_ID Customer_Name 101 John 102 Sarah 103 Mike Here: Customer_ID can be the primary key. Each customer should have a unique ID. 101 → John 102 → Sarah 103 → Mike You shouldn't have two different customers with the same primary key. 7️⃣ What Is a Foreign Key? A Foreign Key is a column used to establish a relationship between tables. Suppose: Customers Customer_ID Customer_Name 101 John 102 Sarah Orders Order_ID Customer_ID Sales 5001 101 50,000 5002 102 70,000 5003 101 30,000 Here: Customers.Customer_ID is the primary key. Orders.Customer_ID can be a foreign key.
The data is often messy.You might receive a monthly Excel file with: • Duplicate records • Missing values • Incorrect data types • Extra spaces • Inconsistent names • Multiple files • Unnecessary columns • Data spread across different tables Cleaning this manually every time is slow and error-prone. That's where Power Query comes in. 1️⃣ What Is Power Query? Power Query is a data preparation and transformation tool available in Excel and Power BI. It allows you to: Connect → Extract → Transform → Load - This is commonly called ETL. Extract: Get data from a source. Transform: Clean and reshape the data. Load: Bring the prepared data into Excel for analysis. The biggest advantage is repeatability. Instead of cleaning the same file manually every month, you create a transformation process once and refresh it. 2️⃣ Why Should a Data Analyst Learn Power Query? Imagine your company sends you this file every month: January.xlsx, February.xlsx, March.xlsx, April.xlsx... Every file contains 50,000 rows, extra spaces, duplicates, incorrect date formats. Without Power Query, you repeat the same cleaning every month. With Power Query: Refresh → Transformations run again 3️⃣ Where Do You Find Power Query? In modern Excel: Data → Get & Transform Data Options: From Table/Range, From Workbook, From Text/CSV, From Folder, From Web, From Database 4️⃣ Understand the Power Query Workflow Data Source → Connect → Power Query Editor → Clean → Transform → Validate → Load → Excel / Data Model → Analysis Power Query records the transformation steps. 5️⃣ Import Data from Excel & CSV Excel: Data → Get Data → From File → From Excel Workbook → Select sheet → Open in Power Query Editor CSV: Data → From Text/CSV → Preview delimiter, headers, data types → Transform Data 6️⃣ Power Query Editor Left side: Queries Middle: Data preview Right side: Applied Steps Example Applied Steps: Source → Changed Type → Removed Columns → Filtered Rows → Removed Duplicates → Renamed Columns → Added Custom Column 7️⃣ Changing Data Types Correct data types are critical. Order ID → Whole Number, Order Date → Date, Sales → Decimal Number, Customer → Text Use the data-type icon to change it. 8️⃣ Remove Duplicates If Order ID should be unique, select the column and use: Remove Rows → Remove Duplicates 🔟 Important: Understand What a Duplicate Means Don't automatically delete duplicates. Ask: > Is this actually a duplicate? Two records with same customer but different orders = Not a duplicate. Same order appearing twice = Duplicate. 1️⃣1️⃣ Remove & Rename Columns Remove unnecessary columns: Home → Remove Columns Rename for clarity: CustNm → Customer Name, SlsAmt → Sales 1️⃣2️⃣ Filter Rows Filtering in Power Query becomes part of the reusable query. Example: Keep only orders from 2026, or North region, or Sales > 0 1️⃣3️⃣ Handle Missing Values Never blindly replace missing values with zero.
