
- Main
- Catalog
- Computer science
- Data Analytics - SQL, Python, Excel, AI & ChatGPT
Data Analytics - SQL, Python, Excel, AI & ChatGPT
Global English-speaking audience in this telegram channel who are interested in learning about new things and data oriented stuff.
Channel statistics
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;
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!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 👍❤️
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 MoreReviews channel
7 total reviews
- Added: Newest first
- Added: Oldest first
- Rating: High to low
- Rating: Low to high
Catalog of Telegram Channels for Native Placements
Data Analytics - SQL, Python, Excel, AI & ChatGPT is a Telegram channel in the category «Интернет технологии», offering effective formats for placing advertising posts on TG. The channel has 108K subscribers and provides quality content. The advertising posts on the channel help brands attract audience attention and increase reach. The channel's rating is 12.7, with 7 reviews and an average score of 5.0.
You can launch an advertising campaign through the Telega.in service, choosing a convenient format for placement. The Platform provides transparent cooperation conditions and offers detailed analytics. The placement cost is 76.8 ₽, and with 43 completed requests, the channel has established itself as a reliable partner for advertising on Telegram. Place integrations today and attract new clients!
You will be able to add channels from the catalog to the cart again.
Комментарий