SQL interview question from live interview

preview_player
Показать описание
Hello All,

Welcome back to my channel.--

Playlist :
Live Interview for Tableau Developer: PART 5

Live Interview for Tableau Developer: PART 4

Live Interview for Tableau Developer: PART 3

Live Interview for Tableau Developer: PART 2

Live Interview for Tableau Developer: PART 1

**************************************************************************
Connect with me on LinkedIn :

**************************************************************************
TAGS:
#data analyst, how to become a data analyst, data analyst job, data analyst career,
#data analytics, a data analyst with no experience, data analyst with no degree,
#data analyst interview, data analyst interview questions, and answers,
#data analyst interview questions, data analyst interview questions for beginners,
#data analyst phone interview, data analyst in-person interview, tableau interview questions,
#tableau interview questions and answers, tableau training

--------------------LIKE /SHARE / SUBSCRIBE -------------------------------
Рекомендации по теме
Комментарии
Автор

-- Highest salary from each department
select dept_name, max(salary) from employee group by dept_name;

-- second highest salary form each departmenrt

select e1.dept_name, max(e1.salary) from employee e1
where e1.salary < (select max(e2.salary) from employee e2 where e1.dept_name = e2.dept_name)
group by e1.dept_name;


select dept_name, group_concat(salary) as salaries from the employee group by dept_name;

CareerBreakout
Автор

please provide the data so that along the video we can practise well, thank you sir for this tutorial. 😇

sumitkumar-jnhe
Автор

Second highest salary can also be done using window function dense

But I have a question which is better to use window function or the one you explained in the video.

For third highest salary

SELECT DISTINCT * FROM
(SELECT department, salary,
DENSE_RANK() OVER(PARTITION BY department ORDER BY salary DESC ) AS rnk
FROM emp_table)AS T
WHERE rnk = 3

jacksparrow
welcome to shbcf.ru