SQL for Data Analysis


Гео и язык канала: не указан, Английский
Категория: Технологии


Find top SQL resources from global universities, cool projects, and learning materials for data analytics.
For promotions: @coderfun
Buy ads: https://telega.io/c/sqlanalyst
Useful links: heylink.me/DataAnalytics

Связанные каналы  |  Похожие каналы

Гео и язык канала
не указан, Английский
Категория
Технологии
Статистика
Фильтр публикаций




15 essential sql interview questions

1️⃣ Explain Order of Execution of SQL query
2️⃣ Provide a use case for each of the functions Rank, Dense_Rank & Row_Number ( 💡 majority struggle )
3️⃣ Write a query to find the cumulative sum/Running Total
4️⃣ Find the Most selling product by sales/ highest Salary of employees
5️⃣ Write a query to find the 2nd/nth highest Salary of employees
6️⃣ Difference between union vs union all
7️⃣ Identify if there any duplicates in a table
8️⃣ Scenario based Joins question, understanding of Inner, Left and Outer Joins via simple yet tricky question
9️⃣ LAG, write a query to find all those records where the transaction value is greater then previous transaction value
1️⃣ 0️⃣ Rank vs Dense Rank, query to find the 2nd highest Salary of employee
( Ideal soln should handle ties)
1️⃣ 1️⃣ Write a query to find the Running Difference (Ideal sol'n using windows function)
1️⃣ 2️⃣ Write a query to display year on year/month on month growth
1️⃣ 3️⃣ Write a query to find rolling average of daily sign-ups
1️⃣ 4️⃣ Write a query to find the running difference using self join (helps in understanding the logical approach, ideally this question is solved via windows function)
1️⃣ 5️⃣ Write a query to find the cumulative sum using self join
(helps in understanding the logical approach, ideally this question is solved via windows function)


Must Know Differences for SQL :



👉 INNER JOIN vs OUTER JOIN:
INNER JOIN: Returns only matching rows from both tables.
OUTER JOIN: Returns matching rows plus non-matching rows from one or both tables (LEFT, RIGHT, or FULL).

👉 VARCHAR vs NVARCHAR:
VARCHAR: Stores non-Unicode characters, taking 1 byte per character.
NVARCHAR: Stores Unicode characters, taking 2 bytes per character.

👉 PRIMARY KEY vs UNIQUE KEY:
PRIMARY KEY: Ensures unique values and does not allow NULLs.
UNIQUE KEY: Ensures unique values but allows a single NULL.

👉 CLUSTERED INDEX vs NON-CLUSTERED INDEX:
CLUSTERED INDEX: Sorts and stores data rows in the table based on the indexed column.
NON-CLUSTERED INDEX: Creates a separate structure from the data rows, with pointers to the original data.

👉 TEMPORARY TABLE vs TABLE VARIABLE:
TEMPORARY TABLE: Created in the tempdb database, persists for the session or until dropped.
TABLE VARIABLE: Stored in memory, scoped to the batch or stored procedure, and typically faster for small datasets.

👉 VIEW vs MATERIALIZED VIEW:
VIEW: A virtual table that does not store data, dynamically retrieves data from the base tables.
MATERIALIZED VIEW: Stores the result of the query physically, providing faster access to large datasets.

👉 STORED PROCEDURE vs FUNCTION:
STORED PROCEDURE: Executes a set of SQL statements and can return multiple values, including result sets.
FUNCTION: Returns a single value or table and can be used in SQL expressions.

👉 SIMPLE RECOVERY MODEL vs FULL RECOVERY MODEL:
SIMPLE RECOVERY MODEL: Does not log transactions in detail, preventing point-in-time restores.
FULL RECOVERY MODEL: Logs all transactions, allowing for point-in-time restores.

👉 RAISERROR vs THROW:
RAISERROR: Used to generate a custom error message, providing more control over the error handling.
THROW: Simplified error handling, introduced in SQL Server 2012, and rethrows the error.

👉 DELETE vs TRUNCATE:
DELETE: Removes rows based on a condition and logs each row deletion.
TRUNCATE: Removes all rows from a table quickly without logging individual row deletions.

Here you can find essential SQL Interview Resources👇
https://topmate.io/analyst/864764

Like this post if you need more 👍❤️

Hope it helps :)


SQL queries that are commonly asked during interviews: 3.O .............



1. Find employees who report to a specific manager:
SELECT employee_id, employee_name
FROM Employee
WHERE manager_id = 101; -- Replace 101 with the specific manager_id;

2. Get the top 3 highest paid employees:
SELECT employee_id, salary
FROM Employee
ORDER BY salary DESC
LIMIT 3;

3. Find products with sales above the average sales:
SELECT product_id, SUM(sales_amount) AS total_sales
FROM Sales
GROUP BY product_id
HAVING total_sales > (SELECT AVG(sales_amount) FROM Sales);

4. Retrieve customers who placed orders within a specific date range:
SELECT customer_id, order_id
FROM Orders
WHERE order_date BETWEEN '2024-01-01' AND '2024-12-31'; -- Replace with your date range

5. Find departments with more than 5 employees:
SELECT department, COUNT(employee_id) AS total_employees
FROM Employee
GROUP BY department
HAVING COUNT(employee_id) > 5;

6. Calculate the average order value for each customer:
SELECT customer_id, AVG(total_amount) AS average_order_value
FROM Orders
GROUP BY customer_id;

7. List products that have been sold at least 5 times:
SELECT product_id, COUNT(order_id) AS times_sold
FROM Sales
GROUP BY product_id
HAVING COUNT(order_id) >= 5;

8. Get the total number of orders placed by each customer per year:
SELECT customer_id, YEAR(order_date) AS year, COUNT(order_id) AS total_orders
FROM Orders
GROUP BY customer_id, YEAR(order_date);

9. Retrieve employees who have worked for more than 5 years:
SELECT employee_id, employee_name
FROM Employee
WHERE DATEDIFF(YEAR, hire_date, GETDATE()) > 5;

10. Find the department with the highest total salary:
SELECT department, SUM(salary) AS total_salary
FROM Employee
GROUP BY department
ORDER BY total_salary DESC
LIMIT 1;

Here you can find essential SQL Interview Resources👇
https://topmate.io/analyst/864764

Like this post if you need more 👍❤️

Hope it helps :)


SQL queries that are commonly asked during interviews: 2.O



1. Retrieve the second-highest salary of employees:
SELECT MAX(salary) AS second_highest_salary
FROM Employee
WHERE salary < (SELECT MAX(salary) FROM Employee);

2. Get the total number of employees in each department:
SELECT department, COUNT(employee_id) AS total_employees
FROM Employee
GROUP BY department;

3. List customers who have not placed any orders:
SELECT c.customer_id, c.customer_name
FROM Customers c
LEFT JOIN Orders o ON c.customer_id = o.customer_id
WHERE o.order_id IS NULL;

4. Find the product with the highest revenue:
SELECT product_id, SUM(quantity * price) AS total_revenue
FROM Sales
GROUP BY product_id
ORDER BY total_revenue DESC
LIMIT 1;


5. Retrieve employees who earn more than the average salary:
SELECT *
FROM Employee
WHERE salary > (SELECT AVG(salary) FROM Employee);

6. Get the list of products sold in the last 7 days:
SELECT DISTINCT product_id
FROM Sales
WHERE order_date >= DATEADD(DAY, -7, GETDATE());

7. Find the number of orders placed each day:
SELECT order_date, COUNT(order_id) AS total_orders
FROM Orders
GROUP BY order_date;

8. Retrieve employees with the same salary:
SELECT employee_id, salary
FROM Employee
GROUP BY salary
HAVING COUNT(employee_id) > 1;

9. List the customers who have placed the most orders:
SELECT customer_id, COUNT(order_id) AS total_orders
FROM Orders
GROUP BY customer_id
ORDER BY total_orders DESC
LIMIT 1;

10. Get the total quantity of each product sold per month:
SELECT product_id, MONTH(order_date) AS month, SUM(quantity) AS total_quantity
FROM Sales
GROUP BY product_id, MONTH(order_date);

Here you can find essential SQL Interview Resources👇
https://topmate.io/analyst/864764

Like this post if you need more 👍❤️

Hope it helps :)


SQL topics that are important for a data analyst role:

✔ Basic SQL Queries
SELECT Statements: Retrieve data from databases.
WHERE Clause: Filter records based on specified conditions.
ORDER BY: Sort results.
LIMIT: Limit the number of returned rows.

✔ Data Aggregation
GROUP BY: Group rows that have the same values in specified columns.
HAVING Clause: Filter groups based on a specified condition.
Aggregate Functions: COUNT(), SUM(), AVG(), MIN(), MAX().

✔ Joins
INNER JOIN
LEFT JOIN
RIGHT JOIN
FULL OUTER JOIN
SELF JOIN
CROSS JOIN

✔Advanced SQL Concepts
Subqueries (Nested Queries): Query within another query.
Common Table Expressions (CTEs): Temporary result set that can be referenced within another SELECT, INSERT, UPDATE, or DELETE statement.

✔ Window Functions: Perform calculations across a set of table rows related to the current row (e.g., ROW_NUMBER(), RANK(), DENSE_RANK(), LEAD(), LAG()).

✔ UNION and UNION ALL: Combine the results of two or more SELECT statements.

✔Data Manipulation
INSERT INTO: Add new rows to a table.
UPDATE: Modify existing records.
DELETE: Remove existing records.

✔Data Definition
CREATE TABLE: Define a new table.
ALTER TABLE: Modify an existing table.
DROP TABLE: Delete a table.
Primary and Foreign Keys: Enforce data integrity and relationships between tables.
Indexes: Improve the speed of data retrieval.

✔Performance Tuning
Query Optimization: Techniques to improve query performance (e.g., indexing, avoiding unnecessary columns in SELECT, avoiding SELECT *).
Execution Plans: Analyze how SQL statements are executed to optimize performance.

✔SQL Functions
String Functions: CONCAT(), SUBSTRING(), REPLACE(), LENGTH().
Date and Time Functions: NOW(), CURDATE(), DATEADD(), DATEDIFF().
Numeric Functions: ROUND(), CEIL(), FLOOR().

✔Error Handling
TRY...CATCH: Handle errors in SQL code (available in some SQL dialects).
Transaction Control: BEGIN TRANSACTION, COMMIT, and ROLLBACK to ensure data integrity.

✔Data Analysis Specific
Pivoting and Unpivoting: Convert rows to columns and vice versa.
Creating Reports: Using SQL to generate detailed data reports.
Data Cleaning and Transformation: Techniques to prepare data for analysis.

✔ Database Management
User Permissions and Roles: Manage access control.
Backup and Restore: Ensure data safety and recovery.

✔ Practical Use Cases
Real-world scenarios: Understanding and solving business problems using SQL.
Case Studies: Applying SQL knowledge to actual data sets and business requirements.

Here you can find SQL Interview Resources👇
https://topmate.io/analyst/864764

Hope it helps :)


Essential SQL interview questions covering various topics:

🔺Basic SQL Concepts:
-Differentiate between SQL and NoSQL databases.
-List common data types in SQL.

🔺Querying:
-Retrieve all records from a table named "Customers."
-Contrast SELECT and SELECT DISTINCT.
-Explain the purpose of the WHERE clause.


🔺Joins:
-Describe types of joins (INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN).
-Retrieve data from two tables using INNER JOIN.

🔺Aggregate Functions:
-Define aggregate functions and name a few.
-Calculate average, sum, and count of a column in SQL.

🔺Grouping and Filtering:
-Explain the GROUP BY clause and its use.
-Filter SQL query results using the HAVING clause.

🔺Subqueries:
-Define a subquery and provide an example.

🔺Indexes and Optimization:
-Discuss the importance of indexes in a database.
&Optimize a slow-running SQL query.

🔺Normalization and Data Integrity:
-Define database normalization and its significance.
-Enforce data integrity in a SQL database.

🔺Transactions:
-Define a SQL transaction and its purpose.
-Explain ACID properties in database transactions.

🔺Views and Stored Procedures:
-Define a database view and its use.
-Distinguish a stored procedure from a regular SQL query.

🔺Advanced SQL:
-Write a recursive SQL query and explain its use.
-Explain window functions in SQL.

✅👀These questions offer a comprehensive assessment of SQL knowledge, ranging from basics to advanced concepts.

❤️Like if you'd like answers in the next post! 👍

Here you can find essential SQL Interview Resources👇
https://topmate.io/analyst/864764

Like this post if you need more 👍❤️

Hope it helps :)


SQL Essential Concepts

𝟭. 𝗜𝗻𝘁𝗿𝗼 𝘁𝗼 𝗦𝗤𝗟: Definition, purpose, relational DBs, DBMS.

𝟮. 𝗕𝗮𝘀𝗶𝗰 𝗦𝗤𝗟 𝗦𝘆𝗻𝘁𝗮𝘅: SELECT, FROM, WHERE, ORDER BY, GROUP BY.

𝟯. 𝗗𝗮𝘁𝗮 𝗧𝘆𝗽𝗲𝘀: Integer, floating-point, character, date, VARCHAR, TEXT, BLOB, BOOLEAN.

𝟰. 𝗦𝘂𝗯 𝗹𝗮𝗻𝗴𝘂𝗮𝗴𝗲𝘀: DML, DDL, DQL, DCL, TCL.

𝟱. 𝗗𝗮𝘁𝗮 𝗠𝗮𝗻𝗶𝗽𝘂𝗹𝗮𝘁𝗶𝗼𝗻: INSERT, UPDATE, DELETE.

𝟲. 𝗗𝗮𝘁𝗮 𝗗𝗲𝗳𝗶𝗻𝗶𝘁𝗶𝗼𝗻: CREATE, ALTER, DROP, Indexes.

𝟳. 𝗤𝘂𝗲𝗿𝘆 𝗙𝗶𝗹𝘁𝗲𝗿𝗶𝗻𝗴 𝗮𝗻𝗱 𝗦𝗼𝗿𝘁𝗶𝗻𝗴: WHERE, AND, OR conditions, ascending, descending.

𝟴. 𝗗𝗮𝘁𝗮 𝗔𝗴𝗴𝗿𝗲𝗴𝗮𝘁𝗶𝗼𝗻: SUM, AVG, COUNT, MIN, MAX.

𝟵. 𝗝𝗼𝗶𝗻𝘀 𝗮𝗻𝗱 𝗥𝗲𝗹𝗮𝘁𝗶𝗼𝗻𝘀𝗵𝗶𝗽𝘀: INNER JOIN, LEFT JOIN, RIGHT JOIN, Self-Joins, Cross Joins, FULL OUTER JOIN.

𝟭𝟬. 𝗦𝘂𝗯𝗾𝘂𝗲𝗿𝗶𝗲𝘀: Filtering data, aggregating data, joining tables, correlated subqueries.

𝟭𝟭. 𝗩𝗶𝗲𝘄𝘀: Creating, modifying, dropping views.

𝟭𝟮. 𝗧𝗿𝗮𝗻𝘀𝗮𝗰𝘁𝗶𝗼𝗻𝘀: ACID properties, COMMIT, ROLLBACK, SAVEPOINT, ROLLBACK TO SAVEPOINT.

𝟭𝟯. 𝗦𝘁𝗼𝗿𝗲𝗱 𝗣𝗿𝗼𝗰𝗲𝗱𝘂𝗿𝗲𝘀: CREATE, ALTER, DROP, EXECUTE, User-Defined Functions (UDFs).

𝟭𝟰. 𝗧𝗿𝗶𝗴𝗴𝗲𝗿𝘀: Trigger events, trigger execution, and syntax.

𝟭𝟱. 𝗦𝗲𝗰𝘂𝗿𝗶𝘁𝘆 𝗮𝗻𝗱 𝗣𝗲𝗿𝗺𝗶𝘀𝘀𝗶𝗼𝗻𝘀: CREATE USER, GRANT, REVOKE, ALTER USER, DROP USER.

𝟭𝟲. 𝗢𝗽𝘁𝗶𝗺𝗶𝘇𝗮𝘁𝗶𝗼𝗻𝘀: Indexing strategies, query optimization.

𝟭𝟳. 𝗡𝗼𝗿𝗺𝗮𝗹𝗶𝘇𝗮𝘁𝗶𝗼𝗻: 1NF, 2NF, 3NF, BCNF.

𝟭𝟴. 𝗡𝗼𝗦𝗤𝗟 𝗗𝗮𝘁𝗮𝗯𝗮𝘀𝗲𝘀: MongoDB, Cassandra, and key differences.

𝟭𝟵. 𝗗𝗮𝘁𝗮 𝗜𝗻𝘁𝗲𝗴𝗿𝗶𝘁𝘆: Primary key, foreign key.

𝟮𝟬. 𝗔𝗱𝘃𝗮𝗻𝗰𝗲𝗱 𝗦𝗤𝗟 𝗤𝘂𝗲𝗿𝗶𝗲𝘀: Window functions, Common Table Expressions (CTES).

Here you can find essential SQL Interview Resources👇
https://topmate.io/analyst/864764

Like this post if you need more 👍❤️

Hope it helps :)

#sql


Top 5 SQL Functions

https://t.me/sqlanalyst

1. SELECT Statement:
- Function: Retrieving data from one or more tables.
- Example: SELECT column1, column2 FROM table WHERE condition;

2. COUNT Function:
- Function: Counts the number of rows that meet a specified condition.
- Example: SELECT COUNT(column) FROM table WHERE condition;

3. SUM Function:
- Function: Calculates the sum of values in a numeric column.
- Example: SELECT SUM(column) FROM table WHERE condition;

4. AVG Function:
- Function: Computes the average value of a numeric column.
- Example: SELECT AVG(column) FROM table WHERE condition;

5. GROUP BY Clause:
- Function: Groups rows that have the same values in specified columns into summary rows.
- Example: SELECT column, AVG(numeric_column) FROM table GROUP BY column;

Here you can find essential SQL Interview Resources👇
https://topmate.io/analyst/864764

Like this post if you need more 👍❤️

Hope it helps :)


Here are some essential SQL tips for beginners 👇👇

◆ Primary Key = Unique Key + Not Null constraint
◆ To perform case insensitive search use UPPER() function ex. UPPER(customer_name) LIKE ‘A%A’
◆ LIKE operator is for string data type
◆ COUNT(*), COUNT(1), COUNT(0) all are same
◆ All aggregate functions ignore the NULL values
◆ Aggregate functions MIN, MAX, SUM, AVG, COUNT are for int data type whereas STRING_AGG is for string data type
◆ For row level filtration use WHERE and aggregate level filtration use HAVING
◆ UNION ALL will include duplicates where as UNION excludes duplicates 
◆ If the results will not have any duplicates, use UNION ALL instead of UNION
◆ We have to alias the subquery if we are using the columns in the outer select query
◆ Subqueries can be used as output with NOT IN condition.
◆ CTEs look better than subqueries. Performance wise both are same.
◆ When joining two tables , if one table has only one value then we can use 1=1 as a condition to join the tables. This will be considered as CROSS JOIN.
◆ Window functions work at ROW level.
◆ The difference between RANK() and DENSE_RANK() is that RANK() skips the rank if the values are the same.
◆ EXISTS works on true/false conditions. If the query returns at least one value, the condition is TRUE. All the records corresponding to the conditions are returned.

Here you can find essential SQL Interview Resources👇
https://topmate.io/analyst/864764

Like this post if you need more 👍❤️

Hope it helps :)


✍️Best practices for writing SQL 📊queries:

1- Write SQL keywords in capital letters.

2- Use table aliases with columns when you are joining multiple tables.

3- Never use select *, always mention list of columns in select clause.

4- Add useful comments wherever you write complex logic. Avoid too many comments.

5- Use joins instead of subqueries when possible for better performance.

6- Create CTEs instead of multiple sub queries , it will make your query easy to read.

7- Join tables using JOIN keywords instead of writing join condition in where clause for better readability.

8- Never use order by in sub queries , It will unnecessary increase runtime.

9- If you know there are no duplicates in 2 tables, use UNION ALL instead of UNION for better performance.

Here you can find essential SQL Interview Resources👇
https://topmate.io/analyst/864764

Like this post if you need more 👍❤️

Hope it helps :)


Complete topics & subtopics of #SQL for Data Engineer role:-

𝟭. 𝗕𝗮𝘀𝗶𝗰 𝗦𝗤𝗟 𝗦𝘆𝗻𝘁𝗮𝘅:
SQL keywords
Data types
Operators
SQL statements (SELECT, INSERT, UPDATE, DELETE)

𝟮. 𝗗𝗮𝘁𝗮 𝗗𝗲𝗳𝗶𝗻𝗶𝘁𝗶𝗼𝗻 𝗟𝗮𝗻𝗴𝘂𝗮𝗴𝗲 (𝗗𝗗𝗟):
CREATE TABLE
ALTER TABLE
DROP TABLE
Truncate table

𝟯. 𝗗𝗮𝘁𝗮 𝗠𝗮𝗻𝗶𝗽𝘂𝗹𝗮𝘁𝗶𝗼𝗻 𝗟𝗮𝗻𝗴𝘂𝗮𝗴𝗲 (𝗗𝗠𝗟):
SELECT statement (SELECT, FROM, WHERE, ORDER BY, GROUP BY, HAVING, JOINs)
INSERT statement
UPDATE statement
DELETE statement

𝟰. 𝗔𝗴𝗴𝗿𝗲𝗴𝗮𝘁𝗲 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀:
SUM, AVG, COUNT, MIN, MAX
GROUP BY clause
HAVING clause

𝟱. 𝗗𝗮𝘁𝗮 𝗖𝗼𝗻𝘀𝘁𝗿𝗮𝗶𝗻𝘁𝘀:
Primary Key
Foreign Key
Unique
NOT NULL
CHECK

𝟲. 𝗝𝗼𝗶𝗻𝘀:
INNER JOIN
LEFT JOIN
RIGHT JOIN
FULL OUTER JOIN
Self Join
Cross Join

𝟳. 𝗦𝘂𝗯𝗾𝘂𝗲𝗿𝗶𝗲𝘀:
Types of subqueries (scalar, column, row, table)
Nested subqueries
Correlated subqueries

𝟴. 𝗔𝗱𝘃𝗮𝗻𝗰𝗲𝗱 𝗦𝗤𝗟 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀:
String functions (CONCAT, LENGTH, SUBSTRING, REPLACE, UPPER, LOWER)
Date and time functions (DATE, TIME, TIMESTAMP, DATEPART, DATEADD)
Numeric functions (ROUND, CEILING, FLOOR, ABS, MOD)
Conditional functions (CASE, COALESCE, NULLIF)

𝟵. 𝗩𝗶𝗲𝘄𝘀:
Creating views
Modifying views
Dropping views

𝟭𝟬. 𝗜𝗻𝗱𝗲𝘅𝗲𝘀:
Creating indexes
Using indexes for query optimization

𝟭𝟭. 𝗧𝗿𝗮𝗻𝘀𝗮𝗰𝘁𝗶𝗼𝗻𝘀:
ACID properties
Transaction management (BEGIN, COMMIT, ROLLBACK, SAVEPOINT)
Transaction isolation levels

𝟭𝟮. 𝗗𝗮𝘁𝗮 𝗜𝗻𝘁𝗲𝗴𝗿𝗶𝘁𝘆 𝗮𝗻𝗱 𝗦𝗲𝗰𝘂𝗿𝗶𝘁𝘆:
Data integrity constraints (referential integrity, entity integrity)
GRANT and REVOKE statements (granting and revoking permissions)
Database security best practices

𝟭𝟯. 𝗦𝘁𝗼𝗿𝗲𝗱 𝗣𝗿𝗼𝗰𝗲𝗱𝘂𝗿𝗲𝘀 𝗮𝗻𝗱 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀:
Creating stored procedures
Executing stored procedures
Creating functions
Using functions in queries

𝟭𝟰. 𝗣𝗲𝗿𝗳𝗼𝗿𝗺𝗮𝗻𝗰𝗲 𝗢𝗽𝘁𝗶𝗺𝗶𝘇𝗮𝘁𝗶𝗼𝗻:
Query optimization techniques (using indexes, optimizing joins, reducing subqueries)
Performance tuning best practices

𝟭𝟱. 𝗔𝗱𝘃𝗮𝗻𝗰𝗲𝗱 𝗦𝗤𝗟 𝗖𝗼𝗻𝗰𝗲𝗽𝘁𝘀:
Recursive queries
Pivot and unpivot operations
Window functions (Row_number, rank, dense_rank, lead & lag)
CTEs (Common Table Expressions)
Dynamic SQL

Here you can find quick SQL Revision Notes👇
https://topmate.io/analyst/864817

Like for more

Hope it helps :)


TOP CONCEPTS FOR INTERVIEW PREPARATION!!

🚀TOP 10 SQL Concepts for Job Interview

1. Aggregate Functions (SUM/AVG)
2. Group By and Order By
3. JOINs (Inner/Left/Right)
4. Union and Union All
5. Date and Time processing
6. String processing
7. Window Functions (Partition by)
8. Subquery
9. View and Index
10. Common Table Expression (CTE)


🚀TOP 10 Statistics Concepts for Job Interview

1. Sampling
2. Experiments (A/B tests)
3. Descriptive Statistics
4. p-value
5. Probability Distributions
6. t-test
7. ANOVA
8. Correlation
9. Linear Regression
10. Logistics Regression


🚀TOP 10 Python Concepts for Job Interview

1. Reading data from file/table
2. Writing data to file/table
3. Data Types
4. Function
5. Data Preprocessing (numpy/pandas)
6. Data Visualisation (Matplotlib/seaborn/bokeh)
7. Machine Learning (sklearn)
8. Deep Learning (Tensorflow/Keras/PyTorch)
9. Distributed Processing (PySpark)
10. Functional and Object Oriented Programming

Like ❤️ the post if it was helpful to you!!!

Here you can find essential SQL Interview Resources👇
https://topmate.io/analyst/864764

Hope it helps :)


Hey guys 👋

Since many of you requested for data analytics recorded video lectures, here you go!
👇👇
https://topmate.io/analyst/1068350

It contains comprehensive recorded video lectures on Data Analytics, covering key tools and languages like SQL, Python, Excel, and Power BI along with hands-on projects to ensure you gain practical experience alongside theoretical knowledge.

Please use the above link to avail them!👆

NOTE: -Most data aspirants hoard resources without actually opening them even once! The reason for keeping a small price for these resources is to ensure that you value the content available inside this and encourage you to make the best out of it.

Hope this helps in your data analytics journey... All the best!👍✌️


Complete 14-day roadmap to learn SQL learning:

Day 1: Introduction to Databases
- Understand the concept of databases and their importance.
- Learn about relational databases and SQL.
- Explore the basic structure of SQL queries.

Day 2: Basic SQL Syntax
- Learn SQL syntax: statements, clauses, and keywords.
- Understand the SELECT statement for retrieving data.
- Practice writing basic SELECT queries with conditions and filters.

Day 3: Retrieving Data from Multiple Tables
- Learn about joins: INNER JOIN, LEFT JOIN, RIGHT JOIN.
- Understand how to retrieve data from multiple tables using joins.
- Practice writing queries involving multiple tables.

Day 4: Aggregate Functions
- Learn about aggregate functions: COUNT, SUM, AVG, MIN, MAX.
- Understand how to use aggregate functions to perform calculations on data.
- Practice writing queries with aggregate functions.

Day 5: Subqueries
- Learn about subqueries and their role in SQL.
- Understand how to use subqueries in SELECT, WHERE, and FROM clauses.
- Practice writing queries with subqueries.

Day 6: Data Manipulation Language (DML)
- Learn about DML commands: INSERT, UPDATE, DELETE.
- Understand how to add, modify, and delete data in a database.
- Practice writing DML statements.

Day 7: Data Definition Language (DDL)
- Learn about DDL commands: CREATE TABLE, ALTER TABLE, DROP TABLE.
- Understand constraints: PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL.
- Practice designing database schemas and creating tables.

Day 8: Data Control Language (DCL)
- Learn about DCL commands: GRANT, REVOKE for managing user permissions.
- Understand how to control access to database objects.
- Practice granting and revoking permissions.

Day 9: Transactions
- Understand the concept of transactions in SQL.
- Learn about transaction control commands: COMMIT, ROLLBACK.
- Practice managing transactions.

Day 10: Views
- Learn about views and their benefits.
- Understand how to create, modify, and drop views.
- Practice creating views.

Day 11: Indexes
- Learn about indexes and their role in database optimization.
- Understand different types of indexes (e.g., B-tree, hash).
- Practice creating and managing indexes.

Day 12: Optimization Techniques
- Explore optimization techniques such as query tuning and normalization.
- Understand the importance of database design for optimization.
- Practice optimizing SQL queries.

Day 13: Review and Practice
- Review all concepts covered in the previous days.
- Work on sample projects or exercises to reinforce learning.
- Take practice quizzes or tests.

Day 14: Final Review and Projects
- Review all concepts learned throughout the 14 days.
- Work on a final project to apply SQL knowledge.
- Seek out additional resources or tutorials if needed.


Here are some practical SQL syntax examples for each day of your learning journey:

Day 1: Introduction to Databases
- Syntax to select all columns from a table:
SELECT * FROM table_name;

Day 2: Basic SQL Syntax
- Syntax to select specific columns from a table:
SELECT column1, column2 FROM table_name;

Day 3: Retrieving Data from Multiple Tables
- Syntax for INNER JOIN to retrieve data from two tables:
SELECT orders.order_id, customers.customer_name
FROM orders
INNER JOIN customers ON orders.customer_id = customers.customer_id;

Day 4: Aggregate Functions
- Syntax for COUNT to count the number of rows in a table:
SELECT COUNT(*) FROM table_name;

Day 5: Subqueries
- Syntax for using a subquery in the WHERE clause:
SELECT column1, column2
FROM table_name
WHERE column1 IN (SELECT column1 FROM another_table WHERE condition);

Day 6: Data Manipulation Language (DML)
- Syntax for INSERT to add data into a table:
INSERT INTO table_name (column1, column2) VALUES (value1, value2);

Here you can find essential SQL Interview Resources👇
https://topmate.io/analyst/864764

Like this post if you need more 👍❤️

Hope it helps :)


Must know SQL basics !!

➡ Explain the order of execution of a SQL query.
➡ Provide a use case for RANK, DENSE_RANK, and ROW_NUMBER and explain when to use each.
➡ Write a query to find the cumulative sum (running total) of sales in a table.
➡ How would you write a query to find the most selling product by sales or the highest salary of employees?
➡ Write a SQL query to find the 2nd or Nth highest salary of employees.
➡ What is the difference between UNION and UNION ALL? Provide a use case for both.
➡ How do you write a query to identify duplicates in a table?
➡ Explain INNER, LEFT, and OUTER joins using a scenario and write a query for each.
➡ Write a query using LAG to find records where the transaction value is greater than the previous transaction value.
➡ What is the difference between RANK and DENSE_RANK, and how would you write a query to find the 2nd highest salary while handling ties?

Here you can find essential SQL Interview Resources👇
https://topmate.io/analyst/864764

Like this post if you need more 👍❤️

Hope it helps :)


7⃣ SQL functions for data cleaning:

1. TRIM():

Usage: Removes leading and trailing whitespace from a string.

Example:

SELECT TRIM(column_name) FROM table_name;

2. UPPER() and LOWER():

Usage: Converts a string to uppercase or lowercase, respectively. This is useful for standardizing data.

Example:

SELECT UPPER(column_name) FROM table_name;

SELECT LOWER(column_name) FROM table_name;

3. COALESCE():

Usage: Returns the first non-null value in a list of arguments. It helps to handle null values effectively.

Example:

SELECT COALESCE(column1, column2, 'default_value') FROM table_name;

4. REPLACE():

Usage: Replaces occurrences of a specified string within another string, which can help in cleaning up data formats.

Example:

SELECT REPLACE(column_name, 'old_value', 'new_value') FROM table_name;

5. SUBSTRING():

Usage: Extracts a substring from a string based on specified starting position and length, useful for cleaning or formatting data.

Example:

SELECT SUBSTRING(column_name, start_position, length) FROM table_name;

6. CAST() and CONVERT():

Usage: Converts one data type to another. This is useful for ensuring data consistency across your database.

Example:

SELECT CAST(column_name AS VARCHAR(255)) FROM table_name;

SELECT CONVERT(VARCHAR(255), column_name) FROM table_name;

7. ISNULL():

Usage: Replaces NULL with a specified replacement value. This can help in making reports more readable.

Example:

SELECT ISNULL(column_name, 'default_value') FROM table_name;

Here you can find SQL Interview Resources👇
https://topmate.io/analyst/864764

Hope it helps :)


❌Common Mistakes In SQL JOINS

Interviewer can only trick you with two things in SQL JOIN questions!🤷

Maximum people are making the most common mistake in SQL JOIN even after gaining few years of experience!

What makes SQL JOIN tricky?
1. Duplicate Values
2. NULL

Once you understand handling both, you can solve any of the toughest SQL JOIN questions in any interview.

@data_analyst/are-you-making-these-2-common-sql-join-mistakes-lets-find-out-655cdf14741e' rel='nofollow'>Read more.....


SQL Essentials

🚀 SELECT
🎯 WHERE CLAUSE
🔄 ORDER BY
📊 Aggregation Functions (MIN, MAX, AVG, COUNT) along with Window
🔑 GROUP BY
🔗 JOINS (INNER, LEFT, RIGHT, FULL, SELF)
🧩 Common Table Expressions (CTE)

Quick SQL Revision Notes

Hope it helps :)


5 Key SQL Aggregate Functions for data analyst

🍞SUM(): Adds up all the values in a numeric column.

🍞AVG(): Calculates the average of a numeric column.

🍞COUNT(): Counts the total number of rows or non-NULL values in a column.

🍞MAX(): Returns the highest value in a column.

🍞MIN(): Returns the lowest value in a column.

Here you can find essential SQL Interview Resources👇
https://topmate.io/analyst/864764

Like this post if you need more 👍❤️

Hope it helps :)

Показано 20 последних публикаций.