๐ก Whatโs Next?
Tomorrow, we will focus on Query Performance Tuning & SQL Optimization Techniques! ๐
๐ฌ Comment below if you have questions! Like โค๏ธ & Share if you're enjoying this SQL series! ๐
Tomorrow, we will focus on Query Performance Tuning & SQL Optimization Techniques! ๐
๐ฌ Comment below if you have questions! Like โค๏ธ & Share if you're enjoying this SQL series! ๐
Day 29: Query Performance Tuning โ Optimize Your SQL Queries ๐
Welcome to Day 29 of your SQL journey! Today, weโll cover:
โ๏ธ How to optimize SQL queries for faster execution.
โ๏ธ Common performance tuning techniques to improve efficiency.
โ๏ธ Best practices for writing optimized SQL queries.
By the end of this lesson, youโll be able to write SQL queries that run faster and handle large datasets efficiently!
---
๐น Why is Query Performance Tuning Important?
When working with databases, slow queries can affect application performance. Optimizing queries helps:
โ๏ธ Reduce execution time โณ
โ๏ธ Handle large amounts of data efficiently ๐
โ๏ธ Improve database performance ๐
---
๐น 1. Use SELECT Only What You Need
โ Bad Query: Selecting All Columns
โ๏ธ This fetches all columns from the table, even if you need only a few.
โ Optimized Query: Select Specific Columns
โ๏ธ This improves performance by fetching only the required data.
---
๐น 2. Use Proper Indexing
Indexes speed up searches by allowing the database to locate data faster.
How to Create an Index?
โ๏ธ This index speeds up queries filtering by Name.
Using Index in Query
โ๏ธ The database will use the index instead of scanning the entire table.
---
๐น 3. Avoid Using Functions on Indexed Columns
Using functions prevents indexes from working efficiently.
โ Bad Query: Function on Indexed Column
โ๏ธ The database has to apply LOWER() on every row, making it slow.
โ Optimized Query: Avoid Functions on Indexed Column
โ๏ธ This allows the index to be used directly, improving speed.
---
๐น 4. Use Joins Efficiently
When joining tables, use INNER JOIN instead of CROSS JOIN if possible.
โ Bad Query: CROSS JOIN (Slow)
โ๏ธ CROSS JOIN generates all possible combinations, leading to performance issues.
โ Optimized Query: Use INNER JOIN
โ๏ธ INNER JOIN fetches only matching rows, reducing unnecessary computations.
---
๐น 5. Use EXISTS Instead of IN for Subqueries
When checking if a record exists in another table, EXISTS is usually faster than IN.
โ Bad Query: Using IN (Slow for Large Data)
โ๏ธ IN executes the subquery multiple times, making it slower.
โ Optimized Query: Using EXISTS
โ๏ธ EXISTS stops checking once a match is found, making it more efficient.
---
๐น 6. Optimize ORDER BY with Indexing
Sorting large datasets can be slow. Adding an index on the ORDER BY column improves performance.
Creating an Index on Sorted Column
Optimized Query
โ๏ธ The database uses the index instead of sorting all rows manually.
---
# ๐น 7. Limit Data Retrieval Using LIMIT or TOP
Fetching too much data slows down performance. Use LIMIT (MySQL, PostgreSQL) or TOP (SQL Server) to limit results.
Optimized Query: Fetch Only First 10 Records
โ๏ธ This ensures only required rows are fetched, making queries faster.
---
๐น 8. Use Proper Data Types
Choosing the right data type saves storage and speeds up queries.
Welcome to Day 29 of your SQL journey! Today, weโll cover:
โ๏ธ How to optimize SQL queries for faster execution.
โ๏ธ Common performance tuning techniques to improve efficiency.
โ๏ธ Best practices for writing optimized SQL queries.
By the end of this lesson, youโll be able to write SQL queries that run faster and handle large datasets efficiently!
---
๐น Why is Query Performance Tuning Important?
When working with databases, slow queries can affect application performance. Optimizing queries helps:
โ๏ธ Reduce execution time โณ
โ๏ธ Handle large amounts of data efficiently ๐
โ๏ธ Improve database performance ๐
---
๐น 1. Use SELECT Only What You Need
โ Bad Query: Selecting All Columns
SELECT * FROM Employees;
โ๏ธ This fetches all columns from the table, even if you need only a few.
โ Optimized Query: Select Specific Columns
SELECT EmployeeID, Name, Salary FROM Employees;
โ๏ธ This improves performance by fetching only the required data.
---
๐น 2. Use Proper Indexing
Indexes speed up searches by allowing the database to locate data faster.
How to Create an Index?
CREATE INDEX idx_employee_name ON Employees(Name);
โ๏ธ This index speeds up queries filtering by Name.
Using Index in Query
SELECT * FROM Employees WHERE Name = 'John Doe';
โ๏ธ The database will use the index instead of scanning the entire table.
---
๐น 3. Avoid Using Functions on Indexed Columns
Using functions prevents indexes from working efficiently.
โ Bad Query: Function on Indexed Column
SELECT * FROM Employees WHERE LOWER(Name) = 'john doe';
โ๏ธ The database has to apply LOWER() on every row, making it slow.
โ Optimized Query: Avoid Functions on Indexed Column
SELECT * FROM Employees WHERE Name = 'John Doe';
โ๏ธ This allows the index to be used directly, improving speed.
---
๐น 4. Use Joins Efficiently
When joining tables, use INNER JOIN instead of CROSS JOIN if possible.
โ Bad Query: CROSS JOIN (Slow)
SELECT Orders.OrderID, Customers.CustomerName
FROM Orders, Customers
WHERE Orders.CustomerID = Customers.CustomerID;
โ๏ธ CROSS JOIN generates all possible combinations, leading to performance issues.
โ Optimized Query: Use INNER JOIN
SELECT Orders.OrderID, Customers.CustomerName
FROM Orders
INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID;
โ๏ธ INNER JOIN fetches only matching rows, reducing unnecessary computations.
---
๐น 5. Use EXISTS Instead of IN for Subqueries
When checking if a record exists in another table, EXISTS is usually faster than IN.
โ Bad Query: Using IN (Slow for Large Data)
SELECT * FROM Employees
WHERE EmployeeID IN (SELECT EmployeeID FROM Salaries WHERE Salary > 50000);
โ๏ธ IN executes the subquery multiple times, making it slower.
โ Optimized Query: Using EXISTS
SELECT * FROM Employees
WHERE EXISTS (SELECT 1 FROM Salaries WHERE Salaries.EmployeeID = Employees.EmployeeID AND Salary > 50000);
โ๏ธ EXISTS stops checking once a match is found, making it more efficient.
---
๐น 6. Optimize ORDER BY with Indexing
Sorting large datasets can be slow. Adding an index on the ORDER BY column improves performance.
Creating an Index on Sorted Column
CREATE INDEX idx_salary ON Employees(Salary);
Optimized Query
SELECT * FROM Employees ORDER BY Salary;
โ๏ธ The database uses the index instead of sorting all rows manually.
---
# ๐น 7. Limit Data Retrieval Using LIMIT or TOP
Fetching too much data slows down performance. Use LIMIT (MySQL, PostgreSQL) or TOP (SQL Server) to limit results.
Optimized Query: Fetch Only First 10 Records
SELECT * FROM Employees LIMIT 10; -- MySQL, PostgreSQL
SELECT TOP 10 * FROM Employees; -- SQL Server
โ๏ธ This ensures only required rows are fetched, making queries faster.
---
๐น 8. Use Proper Data Types
Choosing the right data type saves storage and speeds up queries.
โ Bad Practice: Using Large Data Types
โ๏ธ VARCHAR(500) is too large for names.
โ Optimized Table: Use Smaller Data Types
โ๏ธ TINYINT (1 byte) instead of INT (4 bytes) for Age saves space.
---
๐น 9. Use Partitioning for Large Tables
Partitioning splits a large table into smaller parts for faster queries.
Example: Partitioning a Sales Table by Year
โ๏ธ This makes it faster to search for specific years.
---
๐น 10. Use Query Execution Plan for Optimization
EXPLAIN (MySQL, PostgreSQL) or EXECUTION PLAN (SQL Server) helps analyze how a query runs.
How to Use EXPLAIN?
โ๏ธ It shows if indexes are used and where the query is slow.
---
๐น Summary of SQL Performance Tuning Techniques
| Technique | Benefit |
|--------------|------------|
| Select Only Needed Columns | Reduces memory usage |
| Use Indexing | Speeds up searches |
| Avoid Functions on Indexed Columns | Allows index usage |
| Optimize Joins | Reduces unnecessary computations |
| Use EXISTS Instead of IN | Faster subqueries |
| Optimize ORDER BY | Uses indexes for sorting |
| Use LIMIT/TOP | Fetches only required rows |
| Choose Proper Data Types | Saves storage space |
| Use Partitioning | Speeds up queries on large tables |
| Analyze Execution Plan | Finds slow queries |
---
๐น Your Task for Today
โ Optimize a slow query using indexing or LIMIT.
โ Use EXPLAIN to analyze your query performance.
โ Try EXISTS instead of IN for a subquery.
---
๐ก Whatโs Next?
Tomorrow is the final day โ Day 30: Final Review & SQL Projects! ๐
๐ฌ Comment below if you have questions! Like โค๏ธ & Share if this helped you! ๐
CREATE TABLE Users (
UserID BIGINT,
Name VARCHAR(500),
Age INT
);
โ๏ธ VARCHAR(500) is too large for names.
โ Optimized Table: Use Smaller Data Types
CREATE TABLE Users (
UserID INT,
Name VARCHAR(100),
Age TINYINT
);
โ๏ธ TINYINT (1 byte) instead of INT (4 bytes) for Age saves space.
---
๐น 9. Use Partitioning for Large Tables
Partitioning splits a large table into smaller parts for faster queries.
Example: Partitioning a Sales Table by Year
CREATE TABLE Sales (
SaleID INT,
SaleDate DATE,
Amount DECIMAL(10,2)
) PARTITION BY RANGE (YEAR(SaleDate));
โ๏ธ This makes it faster to search for specific years.
---
๐น 10. Use Query Execution Plan for Optimization
EXPLAIN (MySQL, PostgreSQL) or EXECUTION PLAN (SQL Server) helps analyze how a query runs.
How to Use EXPLAIN?
EXPLAIN SELECT * FROM Employees WHERE Name = 'John Doe';
โ๏ธ It shows if indexes are used and where the query is slow.
---
๐น Summary of SQL Performance Tuning Techniques
| Technique | Benefit |
|--------------|------------|
| Select Only Needed Columns | Reduces memory usage |
| Use Indexing | Speeds up searches |
| Avoid Functions on Indexed Columns | Allows index usage |
| Optimize Joins | Reduces unnecessary computations |
| Use EXISTS Instead of IN | Faster subqueries |
| Optimize ORDER BY | Uses indexes for sorting |
| Use LIMIT/TOP | Fetches only required rows |
| Choose Proper Data Types | Saves storage space |
| Use Partitioning | Speeds up queries on large tables |
| Analyze Execution Plan | Finds slow queries |
---
๐น Your Task for Today
โ Optimize a slow query using indexing or LIMIT.
โ Use EXPLAIN to analyze your query performance.
โ Try EXISTS instead of IN for a subquery.
---
๐ก Whatโs Next?
Tomorrow is the final day โ Day 30: Final Review & SQL Projects! ๐
๐ฌ Comment below if you have questions! Like โค๏ธ & Share if this helped you! ๐
Day 30: Final Review & SQL Projects โ Apply Your Knowledge! ๐
๐ Congratulations! You've reached the final day of your 30-day SQL journey. Today, weโll:
โ Review all key SQL concepts learned over the past 30 days.
โ Work on real-world SQL projects to apply your skills.
โ Solve case studies & challenges to test your knowledge.
By the end of this lesson, youโll be confident in writing SQL queries and solving real-world data problems!
---
๐น Quick Recap: Key SQL Concepts You Learned
| Topic | Key Learnings |
|-----------|------------------|
| Day 1-5: Basics | SQL syntax, SELECT, WHERE, ORDER BY, GROUP BY, HAVING, Aggregate Functions |
| Day 6-10: Joins & Subqueries | INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN, Subqueries |
| Day 11-15: Advanced Queries | Common Table Expressions (CTEs), Window Functions, Case Statements |
| Day 16-20: Views, Transactions, Indexing | Creating Views, Indexing, Transactions & ACID properties, Error Handling |
| Day 21-25: Database Design & Security | Normalization (1NF, 2NF, 3NF, BCNF), Constraints, Backup & Restore, Role-Based Permissions |
| Day 26-29: Performance Optimization | Pivoting, JSON/XML in SQL, Stored Procedures, Triggers, Query Performance Tuning |
If youโve completed all the lessons, you now have a solid SQL foundation! ๐
---
๐น Real-World SQL Projects & Case Studies
Now, letโs apply what youโve learned by working on SQL projects.
Project 1: Analyzing Sales Data ๐
Scenario: You work for an e-commerce company, and management wants to analyze sales performance.
Dataset: Sales Table
| SaleID | Date | CustomerID | ProductID | Quantity | Price | TotalAmount |
|--------|------|------------|------------|---------|------|------------|
| 101 | 2024-01-10 | 1 | 1001 | 2 | 500 | 1000 |
| 102 | 2024-01-11 | 2 | 1002 | 1 | 300 | 300 |
| 103 | 2024-01-12 | 1 | 1003 | 5 | 200 | 1000 |
Tasks:
โ๏ธ Find total sales per customer
โ๏ธ Get the top 5 products by sales revenue
โ๏ธ Find the total revenue for each month
โ๏ธ Find customers who made purchases in January but not in February
๐ฏ Objective: Gain hands-on experience analyzing business sales data.
---
Project 2: Building a Reporting Dashboard ๐
๐น Tools: Use SQL with Power BI, Tableau, or Python (Pandas & Matplotlib)
โ๏ธ Step 1: Write SQL queries to extract data from your database.
โ๏ธ Step 2: Connect SQL with Power BI/Tableau to create reports.
โ๏ธ Step 3: Build visualizations (e.g., bar charts, trend lines, KPIs).
๐ฏ Objective: Convert raw data into actionable insights for decision-making.
---
Project 3: Employee Management System
Scenario: HR wants to track employee performance and salaries.
Dataset: Employees Table
| EmpID | Name | Department | Salary | JoinDate |
|--------|------|------------|--------|---------|
| 1 | Alice | IT | 80000 | 2021-05-10 |
| 2 | Bob | HR | 60000 | 2022-08-15 |
| 3 | Charlie | IT | 90000 | 2019-12-01 |
Tasks:
โ๏ธ Find average salary by department
โ๏ธ List employees who have been with the company for more than 3 years
โ๏ธ Create a stored procedure to update salaries based on department
๐ฏ Objective: Learn how to manage employee data using SQL.
---
๐ Congratulations! You've reached the final day of your 30-day SQL journey. Today, weโll:
โ Review all key SQL concepts learned over the past 30 days.
โ Work on real-world SQL projects to apply your skills.
โ Solve case studies & challenges to test your knowledge.
By the end of this lesson, youโll be confident in writing SQL queries and solving real-world data problems!
---
๐น Quick Recap: Key SQL Concepts You Learned
| Topic | Key Learnings |
|-----------|------------------|
| Day 1-5: Basics | SQL syntax, SELECT, WHERE, ORDER BY, GROUP BY, HAVING, Aggregate Functions |
| Day 6-10: Joins & Subqueries | INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN, Subqueries |
| Day 11-15: Advanced Queries | Common Table Expressions (CTEs), Window Functions, Case Statements |
| Day 16-20: Views, Transactions, Indexing | Creating Views, Indexing, Transactions & ACID properties, Error Handling |
| Day 21-25: Database Design & Security | Normalization (1NF, 2NF, 3NF, BCNF), Constraints, Backup & Restore, Role-Based Permissions |
| Day 26-29: Performance Optimization | Pivoting, JSON/XML in SQL, Stored Procedures, Triggers, Query Performance Tuning |
If youโve completed all the lessons, you now have a solid SQL foundation! ๐
---
๐น Real-World SQL Projects & Case Studies
Now, letโs apply what youโve learned by working on SQL projects.
Project 1: Analyzing Sales Data ๐
Scenario: You work for an e-commerce company, and management wants to analyze sales performance.
Dataset: Sales Table
| SaleID | Date | CustomerID | ProductID | Quantity | Price | TotalAmount |
|--------|------|------------|------------|---------|------|------------|
| 101 | 2024-01-10 | 1 | 1001 | 2 | 500 | 1000 |
| 102 | 2024-01-11 | 2 | 1002 | 1 | 300 | 300 |
| 103 | 2024-01-12 | 1 | 1003 | 5 | 200 | 1000 |
Tasks:
โ๏ธ Find total sales per customer
SELECT CustomerID, SUM(TotalAmount) AS TotalSpent
FROM Sales
GROUP BY CustomerID
ORDER BY TotalSpent DESC;
โ๏ธ Get the top 5 products by sales revenue
SELECT ProductID, SUM(TotalAmount) AS Revenue
FROM Sales
GROUP BY ProductID
ORDER BY Revenue DESC
LIMIT 5;
โ๏ธ Find the total revenue for each month
SELECT DATE_FORMAT(Date, '%Y-%m') AS Month, SUM(TotalAmount) AS Revenue
FROM Sales
GROUP BY Month
ORDER BY Month;
โ๏ธ Find customers who made purchases in January but not in February
SELECT DISTINCT CustomerID
FROM Sales
WHERE DATE_FORMAT(Date, '%Y-%m') = '2024-01'
AND CustomerID NOT IN (
SELECT DISTINCT CustomerID FROM Sales
WHERE DATE_FORMAT(Date, '%Y-%m') = '2024-02'
);
๐ฏ Objective: Gain hands-on experience analyzing business sales data.
---
Project 2: Building a Reporting Dashboard ๐
๐น Tools: Use SQL with Power BI, Tableau, or Python (Pandas & Matplotlib)
โ๏ธ Step 1: Write SQL queries to extract data from your database.
โ๏ธ Step 2: Connect SQL with Power BI/Tableau to create reports.
โ๏ธ Step 3: Build visualizations (e.g., bar charts, trend lines, KPIs).
๐ฏ Objective: Convert raw data into actionable insights for decision-making.
---
Project 3: Employee Management System
Scenario: HR wants to track employee performance and salaries.
Dataset: Employees Table
| EmpID | Name | Department | Salary | JoinDate |
|--------|------|------------|--------|---------|
| 1 | Alice | IT | 80000 | 2021-05-10 |
| 2 | Bob | HR | 60000 | 2022-08-15 |
| 3 | Charlie | IT | 90000 | 2019-12-01 |
Tasks:
โ๏ธ Find average salary by department
SELECT Department, AVG(Salary) AS AvgSalary
FROM Employees
GROUP BY Department;
โ๏ธ List employees who have been with the company for more than 3 years
SELECT Name, JoinDate
FROM Employees
WHERE JoinDate <= DATE_SUB(CURDATE(), INTERVAL 3 YEAR);
โ๏ธ Create a stored procedure to update salaries based on department
DELIMITER //
CREATE PROCEDURE UpdateSalaries()
BEGIN
UPDATE Employees SET Salary = Salary * 1.10 WHERE Department = 'IT';
END //
DELIMITER ;
๐ฏ Objective: Learn how to manage employee data using SQL.
---
๐น Final Challenge: Solve an Advanced SQL Problem
Problem Statement:
You have a table with user transactions. Find the second highest transaction amount for each user.
Dataset: Transactions Table
| TransactionID | UserID | Amount |
|--------------|--------|--------|
| 1 | 101 | 500 |
| 2 | 101 | 700 |
| 3 | 102 | 900 |
| 4 | 101 | 800 |
| 5 | 102 | 1000 |
Solution Using Window Function
โ๏ธ This finds the second highest transaction for each user using RANK().
---
๐น Next Steps: What to Do After Completing This Course?
๐ 1. Keep Practicing SQL
- Use LeetCode (SQL section) for solving challenges.
- Try HackerRank SQL challenges to strengthen your skills.
๐ 2. Build More Projects
- Create a Portfolio Website showcasing your SQL projects.
- Work on real-world datasets (Kaggle, Google BigQuery).
๐ 3. Learn Advanced Topics
- Data Warehousing (OLAP, Snowflake Schema)
- ETL (Extract, Transform, Load) Concepts
- NoSQL Databases (MongoDB, Firebase)
๐ฏ 4. Get Certified
- Microsoft SQL Server Certification
- Google Data Analytics Certificate
- IBM Data Science Professional Certificate
๐ผ 5. Apply for Jobs & Freelance Work
- Look for SQL-related job roles (Data Analyst, Data Engineer).
- Offer SQL consulting services on platforms like Upwork & Fiverr.
---
๐น Final Thoughts: Congratulations on Finishing 30 Days of SQL! ๐
๐ Youโve mastered SQL fundamentals & real-world applications!
โ๏ธ You can now write complex queries, optimize performance, and analyze data.
โ๏ธ Youโre ready to work with databases professionally!
๐ฌ Drop a comment if you completed this 30-day challenge!
๐ฅ Like & Share if this journey helped you!
๐ Next Stop: Data Science, Python, or MAchine LEarning? Whatโs your next goal? Let me know! ๐
Problem Statement:
You have a table with user transactions. Find the second highest transaction amount for each user.
Dataset: Transactions Table
| TransactionID | UserID | Amount |
|--------------|--------|--------|
| 1 | 101 | 500 |
| 2 | 101 | 700 |
| 3 | 102 | 900 |
| 4 | 101 | 800 |
| 5 | 102 | 1000 |
Solution Using Window Function
SELECT UserID, Amount
FROM (
SELECT UserID, Amount,
RANK() OVER (PARTITION BY UserID ORDER BY Amount DESC) AS rnk
FROM Transactions
) Ranked
WHERE rnk = 2;
โ๏ธ This finds the second highest transaction for each user using RANK().
---
๐น Next Steps: What to Do After Completing This Course?
๐ 1. Keep Practicing SQL
- Use LeetCode (SQL section) for solving challenges.
- Try HackerRank SQL challenges to strengthen your skills.
๐ 2. Build More Projects
- Create a Portfolio Website showcasing your SQL projects.
- Work on real-world datasets (Kaggle, Google BigQuery).
๐ 3. Learn Advanced Topics
- Data Warehousing (OLAP, Snowflake Schema)
- ETL (Extract, Transform, Load) Concepts
- NoSQL Databases (MongoDB, Firebase)
๐ฏ 4. Get Certified
- Microsoft SQL Server Certification
- Google Data Analytics Certificate
- IBM Data Science Professional Certificate
๐ผ 5. Apply for Jobs & Freelance Work
- Look for SQL-related job roles (Data Analyst, Data Engineer).
- Offer SQL consulting services on platforms like Upwork & Fiverr.
---
๐น Final Thoughts: Congratulations on Finishing 30 Days of SQL! ๐
๐ Youโve mastered SQL fundamentals & real-world applications!
โ๏ธ You can now write complex queries, optimize performance, and analyze data.
โ๏ธ Youโre ready to work with databases professionally!
๐ฌ Drop a comment if you completed this 30-day challenge!
๐ฅ Like & Share if this journey helped you!
๐ Next Stop: Data Science, Python, or MAchine LEarning? Whatโs your next goal? Let me know! ๐
Hello everyone!!
I hope this 30 day sql series helped you all.
Looking forward to your feedback for future series!! ๐
I hope this 30 day sql series helped you all.
Looking forward to your feedback for future series!! ๐
SQL books wonโt teach you this.
Natural Keys vs. Autoincrement IDs vs. Public IDs. (or maybe all together)
๐ก๐ฎ๐๐๐ฟ๐ฎ๐น ๐๐ฒ๐๐
Natural keys carry intrinsic meaning because they are part of the domain.
They are directly related to the data, making them intuitive and easy to understand. Examples include email addresses or employee IDs.
The problem is that they are usually not good for performance, but they can also be a security risk if you expose them.
๐๐๐๐ผ๐ถ๐ป๐ฐ๐ฟ๐ฒ๐บ๐ฒ๐ป๐ ๐๐๐
Autoincrement IDs automatically generate unique integers to identify rows within a table.
They are often used as primary keys.
Simple integers are fast for the database to index and query. They provide optimal performance.
However, they are vulnerable to enumeration attacks since predicting the next or previous record is easy.
๐ฃ๐๐ฏ๐น๐ถ๐ฐ ๐๐๐ (๐จ๐จ๐๐๐)
UUIDs (Universally Unique Identifiers) are 128-bit identifiers used to uniquely identify information without relying on a centralized authority.
They are difficult to guess, making them suitable for public exposure in APIs.
The problem is they are larger and more complex than integers. This can impact performance, particularly in indexing and storage.
๐๐ถ๐ป๐ฑ๐ถ๐ป๐ด ๐๐ต๐ฒ ๐ฆ๐๐ฒ๐ฒ๐ ๐ฆ๐ฝ๐ผ๐: ๐ ๐ ๐ถ๐ ๐ฒ๐ฑ ๐๐ฝ๐ฝ๐ฟ๐ผ๐ฎ๐ฐ๐ต
Combining different types of keys can offer a balanced solution:
โข InternalID: Used for internal operations and relationships between tables.
โข PublicID: Used in API responses and endpoints to securely reference user records.
โข Email (Natural Key): Used to ensure unique identification of users within the business logic.
The mixed approach keeps your system fast, secure, and easy to understand.
Natural Keys vs. Autoincrement IDs vs. Public IDs. (or maybe all together)
๐ก๐ฎ๐๐๐ฟ๐ฎ๐น ๐๐ฒ๐๐
Natural keys carry intrinsic meaning because they are part of the domain.
They are directly related to the data, making them intuitive and easy to understand. Examples include email addresses or employee IDs.
The problem is that they are usually not good for performance, but they can also be a security risk if you expose them.
๐๐๐๐ผ๐ถ๐ป๐ฐ๐ฟ๐ฒ๐บ๐ฒ๐ป๐ ๐๐๐
Autoincrement IDs automatically generate unique integers to identify rows within a table.
They are often used as primary keys.
Simple integers are fast for the database to index and query. They provide optimal performance.
However, they are vulnerable to enumeration attacks since predicting the next or previous record is easy.
๐ฃ๐๐ฏ๐น๐ถ๐ฐ ๐๐๐ (๐จ๐จ๐๐๐)
UUIDs (Universally Unique Identifiers) are 128-bit identifiers used to uniquely identify information without relying on a centralized authority.
They are difficult to guess, making them suitable for public exposure in APIs.
The problem is they are larger and more complex than integers. This can impact performance, particularly in indexing and storage.
๐๐ถ๐ป๐ฑ๐ถ๐ป๐ด ๐๐ต๐ฒ ๐ฆ๐๐ฒ๐ฒ๐ ๐ฆ๐ฝ๐ผ๐: ๐ ๐ ๐ถ๐ ๐ฒ๐ฑ ๐๐ฝ๐ฝ๐ฟ๐ผ๐ฎ๐ฐ๐ต
Combining different types of keys can offer a balanced solution:
โข InternalID: Used for internal operations and relationships between tables.
โข PublicID: Used in API responses and endpoints to securely reference user records.
โข Email (Natural Key): Used to ensure unique identification of users within the business logic.
The mixed approach keeps your system fast, secure, and easy to understand.
Are you done with watching ๐๐๐ tutorials but don't know where to practice it?
Check out these top 11 online sources that provide practical exercises and challenges to help you master SQL:
1. SQL Zoo: https://sqlzoo.net/wiki/SQL_Tutorial
2. SQLBolt : https://sqlbolt.com/
3. SQLPad: https://sqlpad.io/
4. Mode: https://mode.com/
5. Strata Scratch: https://www.stratascratch.com/
6. LeetCode: https://leetcode.com/problemset/all/
7. HackerRank: https://www.hackerrank.com/domains/sql
8. W3 Schools: https://www.w3schools.com/sql/default.asp
9. SQL Roadmap: https://t.me/sqlspecialist/386
10. Learnsql: https://learnsql.com/?ref=analyst
Check out these top 11 online sources that provide practical exercises and challenges to help you master SQL:
1. SQL Zoo: https://sqlzoo.net/wiki/SQL_Tutorial
2. SQLBolt : https://sqlbolt.com/
3. SQLPad: https://sqlpad.io/
4. Mode: https://mode.com/
5. Strata Scratch: https://www.stratascratch.com/
6. LeetCode: https://leetcode.com/problemset/all/
7. HackerRank: https://www.hackerrank.com/domains/sql
8. W3 Schools: https://www.w3schools.com/sql/default.asp
9. SQL Roadmap: https://t.me/sqlspecialist/386
10. Learnsql: https://learnsql.com/?ref=analyst
Sqlbolt
SQLBolt - Learn SQL - Introduction to SQL
SQLBolt provides a set of interactive lessons and exercises to help you learn SQL
What does TCL stand for in SQL?
Anonymous Quiz
12%
A) Table Control Language
79%
B) Transaction Control Language
6%
C) Temporary Command Language
3%
D) Trigger Control Language
Which SQL statement is used to insert new data in a database?
Anonymous Quiz
27%
Insert New
4%
Add Record
6%
Add New
64%
Insert Into
Which of the following statements about TCL (Transaction Control Language) in SQL is FALSE?
Anonymous Quiz
24%
A) TCL commands are used to manage transactions in a database
39%
B) COMMIT and ROLLBACK are examples of TCL commands.
25%
C) TCL ensures automatic rollback of every transaction after execution.
12%
D) SAVEPOINT allows partial rollback within a transaction.
This media is not supported in your browser
VIEW IN TELEGRAM
Hurry up and enroll within Navratri offer and get low prices! ๐ซถ๐ป๐
WhatsApp at +91-9910986344
WhatsApp at +91-9910986344
Which of the following matches the definition given below: It is an artificial key that aims to uniquely identify each record.
Anonymous Quiz
62%
Primary Key
17%
Foreign Key
13%
Surrogate Key
9%
composite Key
Hey everyone!
It's my dad's birthday today! ๐๐
To celebrate, I'm offering a huge discount on my live python courseโnow just โน3000!
But hurry, this offer is only valid for the next 24 hours! โณ
Grab your spot now! ๐
Ping me on WhatsApp at +91-9910986344
Before the offer ends ๐๐ฅณ
It's my dad's birthday today! ๐๐
To celebrate, I'm offering a huge discount on my live python courseโnow just โน3000!
But hurry, this offer is only valid for the next 24 hours! โณ
Grab your spot now! ๐
Ping me on WhatsApp at +91-9910986344
Before the offer ends ๐๐ฅณ
The most popular programming languages:
1. Python
2. TypeScript
3. JavaScript
4. C#
5. HTML
6. Rust
7. C++
8. C
9. Go
10. Lua
11. Kotlin
12. Java
13. Swift
14. Jupyter Notebook
15. Shell
16. CSS
17. GDScript
18. Solidity
19. Vue
20. PHP
21. Dart
22. Ruby
23. Objective-C
24. PowerShell
25. Scala
According to the Latest GitHub Repositories
1. Python
2. TypeScript
3. JavaScript
4. C#
5. HTML
6. Rust
7. C++
8. C
9. Go
10. Lua
11. Kotlin
12. Java
13. Swift
14. Jupyter Notebook
15. Shell
16. CSS
17. GDScript
18. Solidity
19. Vue
20. PHP
21. Dart
22. Ruby
23. Objective-C
24. PowerShell
25. Scala
According to the Latest GitHub Repositories
SQL, or Structured Query Language, is a domain-specific language used to manage and manipulate relational databases.
A - Aggregate Functions: Functions like COUNT, SUM, AVG, MIN, and MAX used to perform operations on data in a database.
B - BETWEEN: A SQL operator used to filter results within a specific range.
C - CREATE TABLE: SQL statement for creating a new table in a database.
D - DELETE: SQL statement used to delete records from a table.
E - EXISTS: SQL operator used in a subquery to test if a specified condition exists.
F - FOREIGN KEY: A field in a database table that is a primary key in another table, establishing a link between the two tables.
G - GROUP BY: SQL clause used to group rows that have the same values in specified columns.
H - HAVING: SQL clause used in combination with GROUP BY to filter the results.
I - INNER JOIN: SQL clause used to combine rows from two or more tables based on a related column between them.
J - JOIN: Combines rows from two or more tables based on a related column.
K - KEY: A field or set of fields in a database table that uniquely identifies each record.
L - LIKE: SQL operator used in a WHERE clause to search for a specified pattern in a column.
M - MODIFY: SQL command used to modify an existing database table.
N - NULL: Represents missing or undefined data in a database.
O - ORDER BY: SQL clause used to sort the result set in ascending or descending order.
P - PRIMARY KEY: A field in a table that uniquely identifies each record in that table.
Q - QUERY: A request for data from a database using SQL.
R - ROLLBACK: SQL command used to undo transactions that have not been saved to the database.
S - SELECT: SQL statement used to query the database and retrieve data.
T - TRUNCATE: SQL command used to delete all records from a table without logging individual row deletions.
U - UPDATE: SQL statement used to modify the existing records in a table.
V - VIEW: A virtual table based on the result of a SELECT query.
W - WHERE: SQL clause used to filter the results of a query based on a specified condition.
X - (E)XISTS: Used in conjunction with SELECT to test the existence of rows returned by a subquery.
Z - ZERO: Represents the absence of a value in numeric fields or the initial state of boolean fields.
Here you can find essential Pyspark Resources๐
https://www.instagram.com/codingdidi
Like this post if you need more ๐โค๏ธ
Hope it helps :)
A - Aggregate Functions: Functions like COUNT, SUM, AVG, MIN, and MAX used to perform operations on data in a database.
B - BETWEEN: A SQL operator used to filter results within a specific range.
C - CREATE TABLE: SQL statement for creating a new table in a database.
D - DELETE: SQL statement used to delete records from a table.
E - EXISTS: SQL operator used in a subquery to test if a specified condition exists.
F - FOREIGN KEY: A field in a database table that is a primary key in another table, establishing a link between the two tables.
G - GROUP BY: SQL clause used to group rows that have the same values in specified columns.
H - HAVING: SQL clause used in combination with GROUP BY to filter the results.
I - INNER JOIN: SQL clause used to combine rows from two or more tables based on a related column between them.
J - JOIN: Combines rows from two or more tables based on a related column.
K - KEY: A field or set of fields in a database table that uniquely identifies each record.
L - LIKE: SQL operator used in a WHERE clause to search for a specified pattern in a column.
M - MODIFY: SQL command used to modify an existing database table.
N - NULL: Represents missing or undefined data in a database.
O - ORDER BY: SQL clause used to sort the result set in ascending or descending order.
P - PRIMARY KEY: A field in a table that uniquely identifies each record in that table.
Q - QUERY: A request for data from a database using SQL.
R - ROLLBACK: SQL command used to undo transactions that have not been saved to the database.
S - SELECT: SQL statement used to query the database and retrieve data.
T - TRUNCATE: SQL command used to delete all records from a table without logging individual row deletions.
U - UPDATE: SQL statement used to modify the existing records in a table.
V - VIEW: A virtual table based on the result of a SELECT query.
W - WHERE: SQL clause used to filter the results of a query based on a specified condition.
X - (E)XISTS: Used in conjunction with SELECT to test the existence of rows returned by a subquery.
Z - ZERO: Represents the absence of a value in numeric fields or the initial state of boolean fields.
Here you can find essential Pyspark Resources๐
https://www.instagram.com/codingdidi
Like this post if you need more ๐โค๏ธ
Hope it helps :)
Top 10 Advanced SQL Queries for Data Mastery
1. Recursive CTE (Common Table Expressions)
Use a recursive CTE to traverse hierarchical data, such as employees and their managers.
2. Pivoting Data
Turn row data into columns (e.g., show product categories as separate columns).
3. Window Functions
Calculate a running total of sales based on order date.
4. Ranking with Window Functions
Rank employeesโ salaries within each department.
5. Finding Gaps in Sequences
Identify missing values in a sequential dataset (e.g., order numbers).
6. Unpivoting Data
Convert columns into rows to simplify analysis of multiple attributes.
7. Finding Consecutive Events
Check for consecutive days/orders for the same product using
8. Aggregation with the FILTER Clause
Calculate selective averages (e.g., only for the Sales department).
9. JSON Data Extraction
Extract values from JSON columns directly in SQL.
10. Using Temporary Tables
Create a temporary table for intermediate results, then join it with other tables.
Why These Matter
Advanced SQL queries let you handle complex data manipulation and analysis tasks with ease. From traversing hierarchical relationships to reshaping data (pivot/unpivot) and working with JSON, these techniques expand your ability to derive insights from relational databases.
Keep practicing these queries to solidify your SQL expertise and make more data-driven decisions!
Here you can find essential Pyspark Resources๐
https://www.instagram.com/codingdidi
Like this post if you need more ๐โค๏ธ
Hope it helps :)
#sql #dataanalyst
1. Recursive CTE (Common Table Expressions)
Use a recursive CTE to traverse hierarchical data, such as employees and their managers.
WITH RECURSIVE EmployeeHierarchy AS (
SELECT employee_id, employee_name, manager_id
FROM employees
WHERE manager_id IS NULL
UNION ALL
SELECT e.employee_id, e.employee_name, e.manager_id
FROM employees e
JOIN EmployeeHierarchy eh ON e.manager_id = eh.employee_id
)
SELECT *
FROM EmployeeHierarchy;
2. Pivoting Data
Turn row data into columns (e.g., show product categories as separate columns).
SELECT *
FROM (
SELECT TO_CHAR(order_date, 'YYYY-MM') AS month, product_category, sales_amount
FROM sales
) AS pivot_data
PIVOT (
SUM(sales_amount)
FOR product_category IN ('Electronics', 'Clothing', 'Books')
) AS pivoted_sales;
3. Window Functions
Calculate a running total of sales based on order date.
SELECT
order_date,
sales_amount,
SUM(sales_amount) OVER (ORDER BY order_date) AS running_total
FROM sales;
4. Ranking with Window Functions
Rank employeesโ salaries within each department.
SELECT
department,
employee_name,
salary,
RANK() OVER (PARTITION BY department ORDER BY salary DESC) AS salary_rank
FROM employees;
5. Finding Gaps in Sequences
Identify missing values in a sequential dataset (e.g., order numbers).
WITH Sequences AS (
SELECT MIN(order_number) AS start_seq, MAX(order_number) AS end_seq
FROM orders
)
SELECT start_seq + 1 AS missing_sequence
FROM Sequences
WHERE NOT EXISTS (
SELECT 1
FROM orders o
WHERE o.order_number = Sequences.start_seq + 1
);
6. Unpivoting Data
Convert columns into rows to simplify analysis of multiple attributes.
SELECT
product_id,
attribute_name,
attribute_value
FROM products
UNPIVOT (
attribute_value FOR attribute_name IN (color, size, weight)
) AS unpivoted_data;
7. Finding Consecutive Events
Check for consecutive days/orders for the same product using
LAG()
.WITH ConsecutiveOrders AS (
SELECT
product_id,
order_date,
LAG(order_date) OVER (PARTITION BY product_id ORDER BY order_date) AS prev_order_date
FROM orders
)
SELECT product_id, order_date, prev_order_date
FROM ConsecutiveOrders
WHERE order_date - prev_order_date = 1;
8. Aggregation with the FILTER Clause
Calculate selective averages (e.g., only for the Sales department).
SELECT
department,
AVG(salary) FILTER (WHERE department = 'Sales') AS avg_salary_sales
FROM employees
GROUP BY department;
9. JSON Data Extraction
Extract values from JSON columns directly in SQL.
SELECT
order_id,
customer_id,
order_details ->> 'product' AS product_name,
CAST(order_details ->> 'quantity' AS INTEGER) AS quantity
FROM orders;
10. Using Temporary Tables
Create a temporary table for intermediate results, then join it with other tables.
-- Create a temporary table
CREATE TEMPORARY TABLE temp_product_sales AS
SELECT product_id, SUM(sales_amount) AS total_sales
FROM sales
GROUP BY product_id;
-- Use the temp table
SELECT p.product_name, t.total_sales
FROM products p
JOIN temp_product_sales t ON p.product_id = t.product_id;
Why These Matter
Advanced SQL queries let you handle complex data manipulation and analysis tasks with ease. From traversing hierarchical relationships to reshaping data (pivot/unpivot) and working with JSON, these techniques expand your ability to derive insights from relational databases.
Keep practicing these queries to solidify your SQL expertise and make more data-driven decisions!
Here you can find essential Pyspark Resources๐
https://www.instagram.com/codingdidi
Like this post if you need more ๐โค๏ธ
Hope it helps :)
#sql #dataanalyst
15+ interview SQL questions, including both technical and non-technical questions, along with their answers.
1. What is SQL?
- Answer: SQL (Structured Query Language) is a standard programming language specifically designed for managing and manipulating relational databases.
2. What are the different types of SQL statements?
- Answer: SQL statements can be classified into DDL (Data Definition Language), DML (Data Manipulation Language), DCL (Data Control Language), and TCL (Transaction Control Language).
3. What is a primary key?
- Answer: A primary key is a field (or combination of fields) in a table that uniquely identifies each row/record in that table.
4. What is a foreign key?
- Answer: A foreign key is a field (or collection of fields) in one table that uniquely identifies a row of another table or the same table. It establishes a link between the data in two tables.
5. What are joins? Explain different types of joins.
- Answer: A join is an SQL operation for combining records from two or more tables. Types of joins include INNER JOIN, LEFT JOIN (or LEFT OUTER JOIN), RIGHT JOIN (or RIGHT OUTER JOIN), and FULL JOIN (or FULL OUTER JOIN).
6. What is normalization?
- Answer: Normalization is the process of organizing data to reduce redundancy and improve data integrity. This typically involves dividing a database into two or more tables and defining relationships between them.
7. What is denormalization?
- Answer: Denormalization is the process of combining normalized tables into fewer tables to improve database read performance, sometimes at the expense of write performance and data integrity.
8. What is stored procedure?
- Answer: A stored procedure is a prepared SQL code that you can save and reuse. So, if you have an SQL query that you write frequently, you can save it as a stored procedure and then call it to execute it.
9. What is an index?
- Answer: An index is a database object that improves the speed of data retrieval operations on a table at the cost of additional storage and maintenance overhead.
10. What is a view in SQL?
- Answer: A view is a virtual table based on the result set of an SQL query. It contains rows and columns, just like a real table, but does not physically store the data.
11. What is a subquery?
- Answer: A subquery is an SQL query nested inside a larger query. It is used to return data that will be used in the main query as a condition to further restrict the data to be retrieved.
12. What are aggregate functions in SQL?
- Answer: Aggregate functions perform a calculation on a set of values and return a single value. Examples include COUNT, SUM, AVG (average), MIN (minimum), and MAX (maximum).
13. Difference between DELETE and TRUNCATE?
- Answer: DELETE removes rows one at a time and logs each delete, while TRUNCATE removes all rows in a table without logging individual row deletions. TRUNCATE is faster but cannot be rolled back.
14. What is a UNION in SQL?
- Answer: UNION is an operator used to combine the result sets of two or more SELECT statements. It removes duplicate rows between the various SELECT statements.
15. What is a cursor in SQL?
- Answer: A cursor is a database object used to retrieve, manipulate, and navigate through a result set one row at a time.
16. What is trigger in SQL?
- Answer: A trigger is a set of SQL statements that automatically execute or "trigger" when certain events occur in a database, such as INSERT, UPDATE, or DELETE.
17. Difference between clustered and non-clustered indexes?
- Answer: A clustered index determines the physical order of data in a table and can only be one per table. A non-clustered index, on the other hand, creates a logical order and can be many per table.
18. Explain the term ACID.
- Answer: ACID stands for Atomicity, Consistency, Isolation, and Durability.
IF you're looking forward to learn python, dm now on Whatsapp +91-9910986344
1. What is SQL?
- Answer: SQL (Structured Query Language) is a standard programming language specifically designed for managing and manipulating relational databases.
2. What are the different types of SQL statements?
- Answer: SQL statements can be classified into DDL (Data Definition Language), DML (Data Manipulation Language), DCL (Data Control Language), and TCL (Transaction Control Language).
3. What is a primary key?
- Answer: A primary key is a field (or combination of fields) in a table that uniquely identifies each row/record in that table.
4. What is a foreign key?
- Answer: A foreign key is a field (or collection of fields) in one table that uniquely identifies a row of another table or the same table. It establishes a link between the data in two tables.
5. What are joins? Explain different types of joins.
- Answer: A join is an SQL operation for combining records from two or more tables. Types of joins include INNER JOIN, LEFT JOIN (or LEFT OUTER JOIN), RIGHT JOIN (or RIGHT OUTER JOIN), and FULL JOIN (or FULL OUTER JOIN).
6. What is normalization?
- Answer: Normalization is the process of organizing data to reduce redundancy and improve data integrity. This typically involves dividing a database into two or more tables and defining relationships between them.
7. What is denormalization?
- Answer: Denormalization is the process of combining normalized tables into fewer tables to improve database read performance, sometimes at the expense of write performance and data integrity.
8. What is stored procedure?
- Answer: A stored procedure is a prepared SQL code that you can save and reuse. So, if you have an SQL query that you write frequently, you can save it as a stored procedure and then call it to execute it.
9. What is an index?
- Answer: An index is a database object that improves the speed of data retrieval operations on a table at the cost of additional storage and maintenance overhead.
10. What is a view in SQL?
- Answer: A view is a virtual table based on the result set of an SQL query. It contains rows and columns, just like a real table, but does not physically store the data.
11. What is a subquery?
- Answer: A subquery is an SQL query nested inside a larger query. It is used to return data that will be used in the main query as a condition to further restrict the data to be retrieved.
12. What are aggregate functions in SQL?
- Answer: Aggregate functions perform a calculation on a set of values and return a single value. Examples include COUNT, SUM, AVG (average), MIN (minimum), and MAX (maximum).
13. Difference between DELETE and TRUNCATE?
- Answer: DELETE removes rows one at a time and logs each delete, while TRUNCATE removes all rows in a table without logging individual row deletions. TRUNCATE is faster but cannot be rolled back.
14. What is a UNION in SQL?
- Answer: UNION is an operator used to combine the result sets of two or more SELECT statements. It removes duplicate rows between the various SELECT statements.
15. What is a cursor in SQL?
- Answer: A cursor is a database object used to retrieve, manipulate, and navigate through a result set one row at a time.
16. What is trigger in SQL?
- Answer: A trigger is a set of SQL statements that automatically execute or "trigger" when certain events occur in a database, such as INSERT, UPDATE, or DELETE.
17. Difference between clustered and non-clustered indexes?
- Answer: A clustered index determines the physical order of data in a table and can only be one per table. A non-clustered index, on the other hand, creates a logical order and can be many per table.
18. Explain the term ACID.
- Answer: ACID stands for Atomicity, Consistency, Isolation, and Durability.
IF you're looking forward to learn python, dm now on Whatsapp +91-9910986344
You will be 20๐ฑ better at SQL
If you cover these topics in sequence:
๐ฆ๐ค๐ ๐๐ฎ๐๐ถ๐ฐ
1. SELECT and WHERE Clauses | Filtering and retrieving data efficiently
2. GROUP BY and HAVING | Aggregating data with conditional logic
3. JOINs (INNER, LEFT, RIGHT, FULL) | Combining data from multiple tables
4. DISTINCT and LIMIT | Handling duplicates and limiting results
๐ฆ๐ค๐ ๐๐ป๐๐ฒ๐ฟ๐บ๐ฒ๐ฑ๐ถ๐ฎ๐๐ฒ
1. Subqueries | Using queries inside queries for complex filtering
2. Window Functions (ROW_NUMBER, RANK, DENSE_RANK) | Analyzing data over partitions
3. CASE Statements | Conditional logic within your queries
4. Common Table Expressions (CTEs) | Simplifying complex queries for readability
๐ฆ๐ค๐ ๐๐ฑ๐๐ฎ๐ป๐ฐ๐ฒ
1. Recursive CTEs | Solving hierarchical and iterative problems
2. Pivot and Unpivot | Reshaping your data for better insights
3. Temporary Tables | Storing intermediate results for complex operations
4. Optimizing SQL Queries | Improving performance with indexing and query plans
Like if you want more post like this!! ๐คฉ
If you cover these topics in sequence:
๐ฆ๐ค๐ ๐๐ฎ๐๐ถ๐ฐ
1. SELECT and WHERE Clauses | Filtering and retrieving data efficiently
2. GROUP BY and HAVING | Aggregating data with conditional logic
3. JOINs (INNER, LEFT, RIGHT, FULL) | Combining data from multiple tables
4. DISTINCT and LIMIT | Handling duplicates and limiting results
๐ฆ๐ค๐ ๐๐ป๐๐ฒ๐ฟ๐บ๐ฒ๐ฑ๐ถ๐ฎ๐๐ฒ
1. Subqueries | Using queries inside queries for complex filtering
2. Window Functions (ROW_NUMBER, RANK, DENSE_RANK) | Analyzing data over partitions
3. CASE Statements | Conditional logic within your queries
4. Common Table Expressions (CTEs) | Simplifying complex queries for readability
๐ฆ๐ค๐ ๐๐ฑ๐๐ฎ๐ป๐ฐ๐ฒ
1. Recursive CTEs | Solving hierarchical and iterative problems
2. Pivot and Unpivot | Reshaping your data for better insights
3. Temporary Tables | Storing intermediate results for complex operations
4. Optimizing SQL Queries | Improving performance with indexing and query plans
Like if you want more post like this!! ๐คฉ
Power BI Interview Questions Asked Bajaj Auto Ltd
1. Self Introduction
2. What are your roles and responsibilities of your project?
3. Difference between Import Mode and Direct Mode?
4. What kind of projects have you worked on Domain?
5. How do you handle complex data transformations in Power Query? Can you provide an example of a challenging transformation you implemented?
6. What challenges you faced while doing a projects?
7. Types of Refreshes in Power BI?
8. What is DAX in Power BI?
9. How do you perform data cleansing and transformation in Power BI?
10. How do you connect to data sources in Power BI?
11. What are the components in Power BI?
12. What is Power Pivot will do in Power BI?
13. Write a query to fetch top 5 employees having highest salary?
14. Write a query to find 2nd highest salary from employee table?
15. Difference between Rank function & Dense Rank function in SQL?
16. Difference between Power BI Desktop & Power BI Service?
17. How will you optimize Power BI reports?
18. What are the difficulties you have faced when doing a projects?
19. How can you optimize a SQL query?
20. What is Indexes?
21. How ETL process happen in Power BI?
22. What is difference between Star schema & Snowflake schema and how will know when to use which schemas respectively?
23. How will you perform filtering & it's types?
24. What is Bookmarks?
25. Difference between Drilldown and Drill through in Power BI?
26. Difference between Calculated column and measure?
27. Difference between Slicer and Filter?
28. What is a use Pandas, Matplotlib, seaborn Libraries?
29. Difference between Sum and SumX?
30. Do you have any questions?
1. Self Introduction
2. What are your roles and responsibilities of your project?
3. Difference between Import Mode and Direct Mode?
4. What kind of projects have you worked on Domain?
5. How do you handle complex data transformations in Power Query? Can you provide an example of a challenging transformation you implemented?
6. What challenges you faced while doing a projects?
7. Types of Refreshes in Power BI?
8. What is DAX in Power BI?
9. How do you perform data cleansing and transformation in Power BI?
10. How do you connect to data sources in Power BI?
11. What are the components in Power BI?
12. What is Power Pivot will do in Power BI?
13. Write a query to fetch top 5 employees having highest salary?
14. Write a query to find 2nd highest salary from employee table?
15. Difference between Rank function & Dense Rank function in SQL?
16. Difference between Power BI Desktop & Power BI Service?
17. How will you optimize Power BI reports?
18. What are the difficulties you have faced when doing a projects?
19. How can you optimize a SQL query?
20. What is Indexes?
21. How ETL process happen in Power BI?
22. What is difference between Star schema & Snowflake schema and how will know when to use which schemas respectively?
23. How will you perform filtering & it's types?
24. What is Bookmarks?
25. Difference between Drilldown and Drill through in Power BI?
26. Difference between Calculated column and measure?
27. Difference between Slicer and Filter?
28. What is a use Pandas, Matplotlib, seaborn Libraries?
29. Difference between Sum and SumX?
30. Do you have any questions?