Complete topics & subtopics of hashtag #SQL for Data Analyst 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
๐๐ผ๐ถ๐ป ๐บ๐ ๐ง๐ฒ๐น๐ฒ๐ด๐ฟ๐ฎ๐บ ๐๐ต๐ฎ๐ป๐ป๐ฒ๐น - https://t.me/codingdidi
If you've read so far, do LIKE the post๐
๐ญ. ๐๐ฎ๐๐ถ๐ฐ ๐ฆ๐ค๐ ๐ฆ๐๐ป๐๐ฎ๐ :
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
๐๐ผ๐ถ๐ป ๐บ๐ ๐ง๐ฒ๐น๐ฒ๐ด๐ฟ๐ฎ๐บ ๐๐ต๐ฎ๐ป๐ป๐ฒ๐น - https://t.me/codingdidi
If you've read so far, do LIKE the post๐
Telegram
@Codingdidi
Free learning Resources For Data Analysts, Data science, ML, AI, GEN AI and Job updates, career growth, Tech updates
๐27โค3
https://www.linkedin.com/posts/akansha-yadav24_100-dbms-questions-activity-7239652499761086465-gJbH?utm_source=share&utm_medium=member_android
100 DBMS interview Questions
100 DBMS interview Questions
Linkedin
100 DBMs Questions | Akansha Yadav
100 DBMS interview Questions!!
Follow Akansha Yadav For more informational posts.
#dbms #sql #interview #Questions
Follow Akansha Yadav For more informational posts.
#dbms #sql #interview #Questions
๐4โค2
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
๐5๐ฅ2โค1