SQL Interview Question 2025 | Employee Hierarchy | Recursive CTE for Organizational Structure"
In this video, I have discussed how to solve the SQL Interview Questions:
"Write a SQL query to display the entire employee reporting hierarchy using a recursive CTE, showing each employee's level in the hierarchy."
-- Create an Employee Table
CREATE TABLE employees (
id SERIAL PRIMARY KEY,
name VARCHAR(50),
designation VARCHAR(50),
manager_id INT REFERENCES employees(id) ON DELETE SET NULL
);
-- Insert Data
INSERT INTO employees (name, designation, manager_id) VALUES
('Alice', 'CEO', NULL),
('Bob', 'CTO', 1),
('Charlie', 'CFO', 1),
('David', 'Engineering Manager', 2),
('Eve', 'Finance Manager', 3),
('Frank', 'Software Engineer', 4),
('Grace', 'Software Engineer', 4),
('Hannah', 'Accountant', 5);
SQL Interview QnAs Asked in different Companies: https://www.youtube.com/playlist?list=PLg_hSLs-7hbsJjC8r3SWcZmXWZakdgH88
PySpark Basic to Advance: https://www.youtube.com/playlist?list=PLg_hSLs-7hbvIqzZgvViJcxkW09yOwg3L
Resume Building and Interview Preps: https://youtu.be/ShhBumXLGbE
***Join our Telegram Group for regular updates on Jobs and Data Science materials:
https://t.me/datasciencecorner 🔥
https://t.me/datasciencecorner 🔥
Instagram:
https://bit.ly/3LKnSmw 🔥
https://bit.ly/3LKnSmw 🔥
LinkedIn:
https://www.linkedin.com/company/data... 🔥
https://www.linkedin.com/company/data... 🔥
#sql #postgresql #deloitte #deloittejobs #capgeminihiring #cognizant #infosys #tcs #genpactjobs #mysql #interview #dataengineering #dataanalytics #dataanalysis #capgemini #capgeminijobs #sqlfordataengineer #jobinterview #coding #programming #technicalinterview
Видео SQL Interview Question 2025 | Employee Hierarchy | Recursive CTE for Organizational Structure" канала Data Science Corner
"Write a SQL query to display the entire employee reporting hierarchy using a recursive CTE, showing each employee's level in the hierarchy."
-- Create an Employee Table
CREATE TABLE employees (
id SERIAL PRIMARY KEY,
name VARCHAR(50),
designation VARCHAR(50),
manager_id INT REFERENCES employees(id) ON DELETE SET NULL
);
-- Insert Data
INSERT INTO employees (name, designation, manager_id) VALUES
('Alice', 'CEO', NULL),
('Bob', 'CTO', 1),
('Charlie', 'CFO', 1),
('David', 'Engineering Manager', 2),
('Eve', 'Finance Manager', 3),
('Frank', 'Software Engineer', 4),
('Grace', 'Software Engineer', 4),
('Hannah', 'Accountant', 5);
SQL Interview QnAs Asked in different Companies: https://www.youtube.com/playlist?list=PLg_hSLs-7hbsJjC8r3SWcZmXWZakdgH88
PySpark Basic to Advance: https://www.youtube.com/playlist?list=PLg_hSLs-7hbvIqzZgvViJcxkW09yOwg3L
Resume Building and Interview Preps: https://youtu.be/ShhBumXLGbE
***Join our Telegram Group for regular updates on Jobs and Data Science materials:
https://t.me/datasciencecorner 🔥
https://t.me/datasciencecorner 🔥
Instagram:
https://bit.ly/3LKnSmw 🔥
https://bit.ly/3LKnSmw 🔥
LinkedIn:
https://www.linkedin.com/company/data... 🔥
https://www.linkedin.com/company/data... 🔥
#sql #postgresql #deloitte #deloittejobs #capgeminihiring #cognizant #infosys #tcs #genpactjobs #mysql #interview #dataengineering #dataanalytics #dataanalysis #capgemini #capgeminijobs #sqlfordataengineer #jobinterview #coding #programming #technicalinterview
Видео SQL Interview Question 2025 | Employee Hierarchy | Recursive CTE for Organizational Structure" канала Data Science Corner
Комментарии отсутствуют
Информация о видео
11 марта 2025 г. 18:46:48
00:13:47
Другие видео канала