- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
தமிழில் - Coding Series - SQL : Second Highest Salary | SQL Interview | Data Engineer Interview
Video 192: This is the 47th video in our series "Crack SQL Interview in 50 Questions," and in this exercise, we continue with the topic of "Advanced String Functions"
We are given a Employee table which has Employee id and salary. We are asked to write a solution to find the second highest salary from the Employee table. If there is no second highest salary, return null
In this video, we are discussing four different approaches to finding the second highest salary from the Employee table:
*** Approach 1: n00b format using Subquery ***
This approach uses nested subqueries to find the second highest salary. It repeatedly finds the maximum salary that is less than the previous maximum salary until the second highest salary is obtained.
*** Approach 2: Correlated subquery ***
In this approach, a correlated subquery is used to count the number of distinct salaries greater than or equal to each salary in the main query. The salary where this count equals 3 represents the second highest salary.
*** Approach 3: Windows function with subquery format ***
This approach utilizes a window function DENSE_RANK() to rank the salaries in descending order. The outer query then selects the salary corresponding to the rank of 2, which represents the second highest salary.
*** Approach 4: Windows function with CTE table ***
Here, a Common Table Expression (CTE) is used to calculate the dense rank of each salary. The main query then selects the maximum salary where the rank is equal to 2, indicating the second highest salary.
These approaches demonstrate different methods of achieving the same result, showcasing the versatility of SQL in solving such problems.
For a comprehensive understanding of these SQL methodologies and their application, please refer to this explanatory video.
code: https://github.com/jeganpillai/crack_sql_interview_in_50_questions/blob/main/seq01_47_second_highest_salary.sql
Follow me on,
Website : https://growwithdata.co/
YouTube : https://www.youtube.com/@growwithdata
TikTok : https://www.tiktok.com/@growwithdata
LinkedIn : https://www.linkedin.com/company/growwithdata/
Facebook : https://www.facebook.com/growwithdata.co/
FB Group : facebook.com/groups/datainterviewpreparation
twitter : https://twitter.com/growwithdata_co
Instagram : https://www.instagram.com/growwithdata.co/
WhatsApp : https://whatsapp.com/channel/0029VaF8pkb77qVNfbp5pA0S
TheWide : https://thewide.com/profile/891
#sql #dataengineers #tablejoins #ceil #floor #bucket #meta #google #facebook #apple #paypal #netflix #amazon #deinterview #sqlinterview #interviewquestions #leetcode #faang #maanga #mysql #oracle #dbms #query #sqlserver #mysql #coderpad #aggregates #aggregation #nonaggregation #database #placementpreparation #lead #lag #windowsfunction #nullcheck #coalesce #sqlperformance #ifnull #case #lead #lag #windowsfunction #tamil #tamilpython #tamilinterview #tamilinterviewlatest #tamilinterviewquestions #sqlintamil
Видео தமிழில் - Coding Series - SQL : Second Highest Salary | SQL Interview | Data Engineer Interview канала Grow with Data
We are given a Employee table which has Employee id and salary. We are asked to write a solution to find the second highest salary from the Employee table. If there is no second highest salary, return null
In this video, we are discussing four different approaches to finding the second highest salary from the Employee table:
*** Approach 1: n00b format using Subquery ***
This approach uses nested subqueries to find the second highest salary. It repeatedly finds the maximum salary that is less than the previous maximum salary until the second highest salary is obtained.
*** Approach 2: Correlated subquery ***
In this approach, a correlated subquery is used to count the number of distinct salaries greater than or equal to each salary in the main query. The salary where this count equals 3 represents the second highest salary.
*** Approach 3: Windows function with subquery format ***
This approach utilizes a window function DENSE_RANK() to rank the salaries in descending order. The outer query then selects the salary corresponding to the rank of 2, which represents the second highest salary.
*** Approach 4: Windows function with CTE table ***
Here, a Common Table Expression (CTE) is used to calculate the dense rank of each salary. The main query then selects the maximum salary where the rank is equal to 2, indicating the second highest salary.
These approaches demonstrate different methods of achieving the same result, showcasing the versatility of SQL in solving such problems.
For a comprehensive understanding of these SQL methodologies and their application, please refer to this explanatory video.
code: https://github.com/jeganpillai/crack_sql_interview_in_50_questions/blob/main/seq01_47_second_highest_salary.sql
Follow me on,
Website : https://growwithdata.co/
YouTube : https://www.youtube.com/@growwithdata
TikTok : https://www.tiktok.com/@growwithdata
LinkedIn : https://www.linkedin.com/company/growwithdata/
Facebook : https://www.facebook.com/growwithdata.co/
FB Group : facebook.com/groups/datainterviewpreparation
twitter : https://twitter.com/growwithdata_co
Instagram : https://www.instagram.com/growwithdata.co/
WhatsApp : https://whatsapp.com/channel/0029VaF8pkb77qVNfbp5pA0S
TheWide : https://thewide.com/profile/891
#sql #dataengineers #tablejoins #ceil #floor #bucket #meta #google #facebook #apple #paypal #netflix #amazon #deinterview #sqlinterview #interviewquestions #leetcode #faang #maanga #mysql #oracle #dbms #query #sqlserver #mysql #coderpad #aggregates #aggregation #nonaggregation #database #placementpreparation #lead #lag #windowsfunction #nullcheck #coalesce #sqlperformance #ifnull #case #lead #lag #windowsfunction #tamil #tamilpython #tamilinterview #tamilinterviewlatest #tamilinterviewquestions #sqlintamil
Видео தமிழில் - Coding Series - SQL : Second Highest Salary | SQL Interview | Data Engineer Interview канала Grow with Data
sql Data Engineering coalesce ifnull DE Interview sql interview interview questions leetcode FAANG MAANG mysql oracle dbms sqlserver sql server database placement preparation table joins inner join left join right join full join apple paypal netflix meta google facebook amazon maanga aggregation windows function rank dense rank group by lead windowsfunction glassdoor rolling average lag top rows tamil sql in tamil tamil sql tamilsqlinterview tamil interview
Комментарии отсутствуют
Информация о видео
19 апреля 2024 г. 19:13:00
00:14:15
Другие видео канала





















