Загрузка...

#SQL Leetcode SQL 50 #30. 1731. The Number of Employees Which Report to Each Employee.

#SQL Leetcode SQL 50 #30: 1731:

For this problem, we will consider a manager an employee who has at least 1 other employee reporting to them.

Write a solution to report the ids and the names of all managers, the number of employees who report directly to them, and the average age of the reports rounded to the nearest integer.

Return the result table ordered by employee_id.

We will be solving all the questions from LeetCode SQL 50 one by one. These questions range from easy to hard.

--SQL queries used to create and insert data
CREATE TABLE Employees (
employee_id INT,
name VARCHAR(50),
reports_to INT,
age INT
);
INSERT INTO Employees (employee_id, name, reports_to, age) VALUES
(9, 'Hercy', NULL, 43),
(6, 'Alice', 9, 41),
(4, 'Bob', 9, 36),
(2, 'Winston', NULL, 37);
#datascience #coding #programming #mssql #databasemanagement #leetcode #leetcode1071 #leetcodesolution

👉SQL Tutorials Playlist:
https://youtube.com/playlist?list=PL2DNwXX2LoZs3caX9HAW42Eor0Xh1vSCB

👉SQL Shorts Playlist:
https://youtube.com/playlist?list=PL2DNwXX2LoZtW2fgoh-5wF-_zfegjJFtC

👉Python Shorts Playlist:
https://youtube.com/playlist?list=PL2DNwXX2LoZtH_PY68Pus9Urqw-IV3h30

👉Python Tutorials Playlist:
https://youtube.com/playlist?list=PL2DNwXX2LoZu81BduwHZWhbqbRxtpqMYD

👉Excel Shorts Playlist:
https://www.youtube.com/playlist?list=PL2DNwXX2LoZtAkmZlshtmp-asnc1WQ9HL

Видео #SQL Leetcode SQL 50 #30. 1731. The Number of Employees Which Report to Each Employee. канала The Code Samples
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять