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

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

For Promotions: @coderfun @love_data
Download Telegram
Python Interview Questions:

Ready to test your Python skills? Let’s get started! 💻


1. How to check if a string is a palindrome?

def is_palindrome(s):
return s == s[::-1]

print(is_palindrome("madam")) # True
print(is_palindrome("hello")) # False

2. How to find the factorial of a number using recursion?

def factorial(n):
if n == 0 or n == 1:
return 1
return n * factorial(n - 1)

print(factorial(5)) # 120

3. How to merge two dictionaries in Python?

dict1 = {'a': 1, 'b': 2}
dict2 = {'c': 3, 'd': 4}

# Method 1 (Python 3.5+)
merged_dict = {**dict1, **dict2}

# Method 2 (Python 3.9+)
merged_dict = dict1 | dict2

print(merged_dict)

4. How to find the intersection of two lists?

list1 = [1, 2, 3, 4]
list2 = [3, 4, 5, 6]

intersection = list(set(list1) & set(list2))
print(intersection) # [3, 4]

5. How to generate a list of even numbers from 1 to 100?

even_numbers = [i for i in range(1, 101) if i % 2 == 0]
print(even_numbers)

6. How to find the longest word in a sentence?

def longest_word(sentence):
words = sentence.split()
return max(words, key=len)

print(longest_word("Python is a powerful language")) # "powerful"

7. How to count the frequency of elements in a list?

from collections import Counter

my_list = [1, 2, 2, 3, 3, 3, 4]
frequency = Counter(my_list)
print(frequency) # Counter({3: 3, 2: 2, 1: 1, 4: 1})

8. How to remove duplicates from a list while maintaining the order?

def remove_duplicates(lst):
return list(dict.fromkeys(lst))

my_list = [1, 2, 2, 3, 4, 4, 5]
print(remove_duplicates(my_list)) # [1, 2, 3, 4, 5]

9. How to reverse a linked list in Python?

class Node:
def __init__(self, data):
self.data = data
self.next = None

def reverse_linked_list(head):
prev = None
current = head
while current:
next_node = current.next
current.next = prev
prev = current
current = next_node
return prev

# Create linked list: 1 -> 2 -> 3
head = Node(1)
head.next = Node(2)
head.next.next = Node(3)

# Reverse and print the list
reversed_head = reverse_linked_list(head)
while reversed_head:
print(reversed_head.data, end=" -> ")
reversed_head = reversed_head.next

10. How to implement a simple binary search algorithm?

def binary_search(arr, target):
low, high = 0, len(arr) - 1
while low <= high:
mid = (low + high) // 2
if arr[mid] == target:
return mid
elif arr[mid] < target:
low = mid + 1
else:
high = mid - 1
return -1

print(binary_search([1, 2, 3, 4, 5, 6, 7], 4)) # 3


Here you can find essential Python Interview Resources👇
https://news.1rj.ru/str/DataSimplifier

Like for more resources like this 👍 ♥️

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

Hope it helps :)
👍336👌4🔥1👏1🎉1
Tableau Cheat Sheet

This Tableau cheatsheet is designed to be your quick reference guide for data visualization and analysis using Tableau. Whether you’re a beginner learning the basics or an experienced user looking for a handy resource, this cheatsheet covers essential topics.

1. Connecting to Data
- Use *Connect* pane to connect to various data sources (Excel, SQL Server, Text files, etc.).

2. Data Preparation
- Data Interpreter: Clean data automatically using the Data Interpreter.
- Join Data: Combine data from multiple tables using joins (Inner, Left, Right, Outer).
- Union Data: Stack data from multiple tables with the same structure.

3. Creating Views
- Drag & Drop: Drag fields from the Data pane onto Rows, Columns, or Marks to create visualizations.
- Show Me: Use the *Show Me* panel to select different visualization types.

4. Types of Visualizations
- Bar Chart: Compare values across categories.
- Line Chart: Display trends over time.
- Pie Chart: Show proportions of a whole (use sparingly).
- Map: Visualize geographic data.
- Scatter Plot: Show relationships between two variables.

5. Filters
- Dimension Filters: Filter data based on categorical values.
- Measure Filters: Filter data based on numerical values.
- Context Filters: Set a context for other filters to improve performance.

6. Calculated Fields
- Create calculated fields to derive new data:
- Example: Sales Growth = SUM([Sales]) - SUM([Previous Sales])

7. Parameters
- Use parameters to allow user input and control measures dynamically.

8. Formatting
- Format fonts, colors, borders, and lines using the Format pane for better visual appeal.

9. Dashboards
- Combine multiple sheets into a dashboard using the *Dashboard* tab.
- Use dashboard actions (filter, highlight, URL) to create interactivity.

10. Story Points
- Create a story to guide users through insights with narrative and visualizations.

11. Publishing & Sharing
- Publish dashboards to Tableau Server or Tableau Online for sharing and collaboration.

12. Export Options
- Export to PDF or image for offline use.

13. Keyboard Shortcuts
- Show/Hide Sidebar: Ctrl+Alt+T
- Duplicate Sheet: Ctrl + D
- Undo: Ctrl + Z
- Redo: Ctrl + Y

14. Performance Optimization
- Use extracts instead of live connections for faster performance.
- Optimize calculations and filters to improve dashboard loading times.

Best Resources to learn Tableau: https://news.1rj.ru/str/PowerBI_analyst

Hope you'll like it

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

Hope it helps :)
👍292👏2👌2🔥1
Let's go through each of the above topics one by one

1. Writing Complex JOIN Queries

Complex JOINs can be intimidating, especially when working with multiple tables, but with a structured approach, you can simplify them. Here’s how:

Understand Different Types of JOINs: Ensure you're familiar with the four basic types of JOINs—INNER JOIN (returns only matching rows), LEFT JOIN (returns all rows from the left table and matching rows from the right), RIGHT JOIN (returns all rows from the right table and matching rows from the left), and FULL OUTER JOIN (returns rows when there is a match in one of the tables).

Visualize Relationships: Before you write the query, map out how tables are connected.

Are they linked by foreign keys?

Do they share columns like IDs or other identifiers?

Drawing a diagram helps avoid confusion.

Start Simple: Instead of jumping straight into a complex multi-table JOIN, start by querying just two tables. Test that the result is correct before adding more tables.

Alias Tables: Use short aliases for table names. This not only makes your query easier to read but reduces the chance of making mistakes in longer queries.

Use Filters Wisely: When using multiple JOINs, WHERE clauses can affect the outcome significantly. Always check the data returned after each JOIN to make sure your filters are applied correctly.

Test with Different Data Sets: Always test your complex JOIN queries with edge cases—such as when one table has missing or NULL values—to make sure you are handling these situations properly.


Example:
SELECT 
employees.name,
departments.department_name,
projects.project_name
FROM employees
INNER JOIN departments ON employees.department_id = departments.department_id
LEFT JOIN projects ON employees.project_id = projects.project_id
WHERE departments.department_name = 'IT';

In this query, we use an INNER JOIN to match employees with their departments and a LEFT JOIN to include project details, even if an employee isn't currently assigned to a project.

If you’re stuck, use CTEs (Common Table Expressions) or break the query into smaller parts to debug it.

Here you can find SQL Interview Resources👇
https://news.1rj.ru/str/DataSimplifier

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

Hope it helps :)
👍245🔥1👏1
Data Analytics
What SQL topic do you find the most challenging?
Today, let's go through second important topic of the poll

Optimizing Query Performance in SQL

When working with large datasets, optimizing query performance becomes crucial. Slow queries can impact application speed and user experience. Here’s how you can ensure your SQL queries run efficiently:

Indexing Matters: One of the easiest ways to speed up queries is by creating indexes on columns frequently used in WHERE, JOIN, or GROUP BY clauses. However, avoid over-indexing, as this can slow down write operations like INSERT or UPDATE.

Use SELECT * Sparingly: Always specify the columns you need instead of using SELECT *. Pulling unnecessary columns can increase query execution time, especially with large tables.

Analyze Execution Plans: Most database systems allow you to view the execution plan for a query. This shows you how the query is processed, which can help identify bottlenecks such as table scans or improper index usage.

Limit the Results: If you only need a subset of the data (e.g., the top 10 rows), use LIMIT or TOP to reduce the data load.

Avoid N+1 Queries: Instead of running multiple queries in a loop (like fetching records one by one), use a single query with IN or a JOIN to retrieve all needed data at once.

Partition Large Tables: If you're dealing with massive tables, partitioning the data can improve query speed by allowing the database to search only a segment of the table.

Optimize Subqueries and Joins: For complex queries with multiple subqueries or joins, sometimes rewriting them as CTEs (Common Table Expressions) can improve readability and performance. Additionally, avoid correlated subqueries when possible, as they tend to be slower than joins.


Example:

SELECT customers.customer_name,
orders.order_date
FROM customers
JOIN orders ON customers.customer_id = orders.customer_id
WHERE orders.order_date > '2023-01-01'
ORDER BY orders.order_date
LIMIT 10;

In this query:

Indexes on customer_id and order_date will speed up the JOIN and WHERE clauses. Using LIMIT 10 ensures the query fetches only 10 results, reducing the load on the database.

Continuously monitor query performance in production environments. Even small improvements (e.g., reducing query time from 2 seconds to 1 second) can make a significant difference when queries are run frequently.

Here you can find SQL Interview Resources👇
https://news.1rj.ru/str/DataSimplifier

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

Hope it helps :)
👍257👎1
Going live for the first time, lessssgooooooooo 😁
24👍12🔥8👌1
Live stream started
Live stream finished (42 minutes)
Data Analytics
Going live for the first time, lessssgooooooooo 😁
I enjoyed connecting with you all. Thanks everyone for the kind words, it really motivates me to post more content in the future ❤️
26👍7👏1
Data Analytics
I enjoyed connecting with you all. Thanks everyone for the kind words, it really motivates me to post more content in the future ❤️
Special thanks to RJ for appreciating the efforts. Here are some resources which may help you with storytelling 👇👇
👍92
5_6062388794055726470.pdf
66.3 KB
Storytelling Resources
👍104🥰3👏1👌1
Don't know why but somehow telegram stopped showing our channel in searches, I would really appreciate if you guys can share our channel link with your friends and loved ones who want to enter into data analytics domain 👇
https://news.1rj.ru/str/sqlspecialist

Thanks again ❤️
👍1811👌4🎉1
You can find data analyst job & internship opportunities on this WhatsApp channel 👇👇
https://whatsapp.com/channel/0029VaGgzAk72WTmQFERKh02
10👍2
How to Become a Data Analyst from Scratch! 🚀

Whether you're starting fresh or upskilling, here's your roadmap:

➜ Master Excel and SQL - solve SQL problems from leetcode & hackerank
➜ Get the hang of either Power BI or Tableau - do some hands-on projects
➜ learn what the heck ATS is and how to get around it
➜ learn to be ready for any interview question
➜ Build projects for a data portfolio
➜ And you don't need to do it all at once!
➜ Fail and learn to pick yourself up whenever required

Whether it's acing interviews or building an impressive portfolio, give yourself the space to learn, fail, and grow. Good things take time

You can find the detailed article here

Like if it helps ❤️

I have curated best 80+ top-notch Data Analytics Resources 👇👇
https://news.1rj.ru/str/DataSimplifier

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

Hope it helps :)
👍2417👏2👌2
Data Analytics
What SQL topic do you find the most challenging?
Let's go through the next topic today

How to use Subqueries Effectively

Subqueries are incredibly useful when you need to perform a query within a query. However, they can sometimes be challenging to use efficiently. Here’s how to master subqueries for cleaner and more powerful SQL queries:

Types of Subqueries:

Scalar Subqueries: These return a single value and are often used in SELECT or WHERE clauses.

Row Subqueries: These return one row and are used with IN or EXISTS.

Table Subqueries: These return multiple rows and columns and can be used in the FROM clause as a derived table.


Use Cases: Subqueries are great for breaking complex logic into smaller, more manageable pieces. Common use cases include filtering records based on aggregate results or comparing data between two tables without using a JOIN.

Performance Considerations: While subqueries are powerful, they can sometimes be slower than JOINs, especially when nested multiple times. Consider using JOINs or Common Table Expressions (CTEs) as alternatives for performance optimization.

Avoid Correlated Subqueries: Correlated subqueries reference columns from the outer query, which means the subquery runs repeatedly for each row in the outer query. This can be inefficient for large datasets. Use them only when necessary, and always check performance.


Example:

SELECT customer_id, customer_name
FROM customers
WHERE customer_id IN (
SELECT customer_id
FROM orders
WHERE order_date > '2023-01-01'
);

In this example, the subquery retrieves customer IDs that placed orders after a specific date. The outer query uses this subquery to filter the list of customers.

Alternative with JOIN:

While subqueries are useful, a JOIN can sometimes be more efficient. The query above could be rewritten as a JOIN:


SELECT DISTINCT customers.customer_id, customers.customer_name
FROM customers
JOIN orders ON customers.customer_id = orders.customer_id
WHERE orders.order_date > '2023-01-01';


Choose Wisely: Always consider whether a subquery or a JOIN makes more sense for the specific problem. JOINs are typically faster for larger datasets, but subqueries can be more readable in some cases.

When working with subqueries, always test their performance, especially if they are nested within other queries or return large result sets. Consider using indexing to improve speed where possible.


Writing Complex Joins

Optimise Complex SQL Queries

Here you can find SQL Interview Resources👇
https://news.1rj.ru/str/DataSimplifier

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

Hope it helps :)
👍257👏2
Data Analytics
Let's go through the next topic today How to use Subqueries Effectively Subqueries are incredibly useful when you need to perform a query within a query. However, they can sometimes be challenging to use efficiently. Here’s how to master subqueries for…
Today, let's go through next challenging SQL topic:

Working with Window Functions

Window functions are a powerful SQL tool for performing calculations across a set of table rows related to the current row. Unlike aggregate functions, which collapse rows into a single value, window functions keep individual rows while allowing you to calculate running totals, rankings, and more. Here’s how you can use them effectively:

Syntax Overview: Window functions use the OVER() clause, which defines how the rows are partitioned and ordered. A typical window function looks like this:

SELECT column_name, 
window_function() OVER (PARTITION BY column_name ORDER BY column_name) AS alias
FROM table_name;

Key Use Cases:

Rankings and Row Numbers: Use functions like RANK(), ROW_NUMBER(), and DENSE_RANK() to rank data while preserving individual rows.

Running Totals: Use SUM() with a window to compute cumulative totals over a partition of rows.

Moving Averages: Use AVG() with a window to calculate averages over a specific range of rows (e.g., for trend analysis).

Lag and Lead: These functions allow you to access data from previous or subsequent rows without using self-joins.


PARTITION BY vs. ORDER BY:

PARTITION BY works like a GROUP BY clause, dividing the data into segments before applying the window function.

ORDER BY specifies how the rows within each partition are ordered for the window function calculation.


Common Window Functions:

ROW_NUMBER(): Assigns a unique number to each row in the result set.

RANK(): Assigns a rank to each row with gaps between tied ranks.

DENSE_RANK(): Similar to RANK(), but without gaps between ranks.

SUM(), AVG(): Can be used to calculate running totals or averages.



Example: Cumulative Total

SELECT 
employee_id,
salary,
SUM(salary) OVER (ORDER BY employee_id) AS cumulative_salary
FROM employees;

In this query, we calculate a cumulative total of salaries as we move down the list of employees ordered by employee_id. The SUM() function calculates the running total without collapsing rows.

Example: Ranking Employees by Salary

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

Here, the RANK() function assigns a rank to each employee based on their salary, with the highest-paid employee getting a rank of 1.

Window functions are highly flexible and can replace more complex queries involving JOINs and GROUP BY. When working with large datasets, make sure to test performance, as window functions can be computationally intensive.

Here you can find SQL Interview Resources👇
https://news.1rj.ru/str/DataSimplifier

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

Hope it helps :)
👍196
Data Analytics
What SQL topic do you find the most challenging?
Today, let's explore next Advanced SQL Topic

Writing Stored Procedures and Functions

Stored procedures and functions are essential in SQL when you want to automate repetitive tasks, enhance security, and improve performance by reducing client-server interactions. Here’s how to use them effectively:

Stored Procedures: A stored procedure is a set of SQL statements that you can execute repeatedly. You can pass parameters to a stored procedure, which makes it versatile for tasks like updating records or generating reports.

Use Cases:

Automating tasks like daily data imports or backups.

Performing complex data transformations.

Enforcing business rules with reusable logic.


Syntax:

CREATE PROCEDURE procedure_name (parameters)
BEGIN
-- SQL statements
END;

Example:

CREATE PROCEDURE UpdateEmployeeSalary (IN employee_id INT, IN new_salary DECIMAL(10, 2))
BEGIN
UPDATE employees
SET salary = new_salary
WHERE id = employee_id;
END;

This procedure updates an employee's salary based on their ID.


Functions: Functions are similar to stored procedures but are used to return a value. They’re typically used for computations and can be used in queries like regular expressions.

Use Cases:

Returning computed values, such as calculating total sales or tax.

Custom transformations or data validations.


Syntax:

CREATE FUNCTION function_name (parameters)
RETURNS return_type
BEGIN
-- SQL statements
RETURN value;
END;

Example:

CREATE FUNCTION GetEmployeeBonus (salary DECIMAL(10, 2))
RETURNS DECIMAL(10, 2)
BEGIN
RETURN salary * 0.10;
END;

In this example, the function returns 10% of an employee's salary as their bonus.


Key Differences Between Procedures and Functions:

Return Values: Procedures do not have to return a value, whereas functions must return a value.

Usage in Queries: Functions can be called from within a SELECT statement, while stored procedures cannot.

Transaction Management: Stored procedures can manage transactions (BEGIN, COMMIT, ROLLBACK), whereas functions cannot.


Performance Benefits:

Reduced Network Traffic: Since the logic is stored on the server, stored procedures reduce the need for multiple round-trips between the client and server.

Execution Plans: Stored procedures benefit from precompiled execution plans, which can improve performance on frequently executed queries.



Example: Using a Function in a Query

SELECT 
employee_id,
salary,
GetEmployeeBonus(salary) AS bonus
FROM employees;

In this query, the custom function GetEmployeeBonus() is used to calculate a bonus for each employee based on their salary.

Use stored procedures and functions when you need reusable, secure, and efficient ways to handle complex logic and repetitive tasks in your database.

Writing Complex Joins

Optimise Complex SQL Queries

How to use Subqueries in SQL

Working with window functions

Like for more ❤️

Here you can find SQL Interview Resources👇
https://news.1rj.ru/str/DataSimplifier

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

Hope it helps :)
👍218🥰4
Hi guys,

Many people charge too much to teach Excel, Power BI, SQL, Python & Tableau but my mission is to break down barriers. I have shared complete learning series to start your data analytics journey from scratch.

For those of you who are new to this channel, here are some quick links to navigate this channel easily.

Data Analyst Learning Plan 👇
https://news.1rj.ru/str/sqlspecialist/752

Python Learning Plan 👇
https://news.1rj.ru/str/sqlspecialist/749

Power BI Learning Plan 👇
https://news.1rj.ru/str/sqlspecialist/745

SQL Learning Plan 👇
https://news.1rj.ru/str/sqlspecialist/738

SQL Learning Series 👇
https://news.1rj.ru/str/sqlspecialist/567

Excel Learning Series 👇
https://news.1rj.ru/str/sqlspecialist/664

Power BI Learning Series 👇
https://news.1rj.ru/str/sqlspecialist/768

Python Learning Series 👇
https://news.1rj.ru/str/sqlspecialist/615

Tableau Essential Topics 👇
https://news.1rj.ru/str/sqlspecialist/667

Best Data Analytics Resources 👇
https://heylink.me/DataAnalytics

You can find more resources on Medium & Linkedin

Like for more ❤️

Thanks to all who support our channel and share it with friends & loved ones. You guys are really amazing.

Hope it helps :)
👍5939👏4🥰3👎2🎉2
This Telegram channel is a hidden gem for anyone seeking job opportunities in data analytics
👇👇
https://news.1rj.ru/str/jobs_SQL

I usually don’t go out of my way to recommend channels, but this one is truly worth it. Whether you're on the hunt for data analyst jobs or need interview tips, this channel has everything you need.

Hope it helps :)
19👍13
Commit and master 𝗦𝗤𝗟 in just 𝟯𝟬 𝗗𝗮𝘆𝘀!

I've outlined a simple, actionable plan for you to follow…

𝗪𝗲𝗲𝗸 𝟭: 𝗕𝗮𝘀𝗶𝗰𝘀 𝗼𝗳 𝗦𝗤𝗟

➛ Day 1-2: Introduction to SQL, setting up your environment (MySQL/PostgreSQL/SQL Server).

➛ Day 3-4: Understanding databases, tables, and basic SQL syntax.

➛ Day 5-7: Working with SELECT, WHERE, and filtering data.

𝗪𝗲𝗲𝗸 𝟮: 𝗖𝗼𝗿𝗲 𝗤𝘂𝗲𝗿𝗶𝗲𝘀

➛ Day 8-10: Using JOINs – INNER, LEFT, RIGHT, FULL.

➛ Day 11-13: GROUP BY, HAVING, and aggregate functions (SUM, COUNT, AVG).

➛ Day 14: Practice session – write complex queries.

𝗪𝗲𝗲𝗸 𝟯: 𝗠𝗼𝗱𝗶𝗳𝘆𝗶𝗻𝗴 𝗗𝗮𝘁𝗮

➛ Day 15-17: INSERT, UPDATE, DELETE – altering your data.

➛ Day 18-20: Subqueries, nested queries, and derived tables.

➛ Day 21: Practice session – work on a mini-project.

𝗪𝗲𝗲𝗸 𝟰: 𝗔𝗱𝘃𝗮𝗻𝗰𝗲𝗱 𝗦𝗤𝗟 𝗧𝗼𝗽𝗶𝗰𝘀 𝗮𝗻𝗱 𝗣𝗿𝗼𝗷𝗲𝗰𝘁

➛ Day 22-24: Window functions, RANK, DENSE_RANK, ROW_NUMBER.

➛ Day 25-27: Creating and managing indexes, views, and stored procedures.

➛ Day 28-30: Capstone project – work with real-world data to design and query a database.

Here you can find SQL Interview Resources👇
https://news.1rj.ru/str/DataSimplifier

Like this post if you need more 👍❤️

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

Hope it helps :)
👍4022