IBM SQL Interview Question | Using CTEs

  Рет қаралды 3,053

Nishtha Nagar

Nishtha Nagar

Күн бұрын

Пікірлер: 11
@rajanchaurasiya1734
@rajanchaurasiya1734 2 ай бұрын
with cte as( select *, dense_rank() over(partition by job_category order by salary desc) as rnk from employees ) select employee_id,first_name,job_category from cte where rnk = 3 order by employee_id;
@nirmalaswain4598
@nirmalaswain4598 3 ай бұрын
thank you mam for such a great kind kind of seriese please continue this section
@badrilalnagar9232
@badrilalnagar9232 3 ай бұрын
The family system of India is the basic source of Indian culture.
@harshitsalecha221
@harshitsalecha221 3 ай бұрын
SELECT employee_id, first_name, job_category FROM (SELECT employee_id, first_name, job_category, DENSE_RANK() OVER(PARTITION BY job_category ORDER BY salary DESC) as rn FROM employees) as a WHERE rn=3;
@mohanbharadwaj7684
@mohanbharadwaj7684 3 ай бұрын
which is more optimized query. Subquery or CTE's
@DevaSivaNagaSai
@DevaSivaNagaSai 3 ай бұрын
cte is more efficient than sub query
@saikirant4677
@saikirant4677 3 ай бұрын
clearly explained
@vijeayanvj4367
@vijeayanvj4367 Ай бұрын
select employee_id,first_name,job_category from (select employee_id,first_name,salary,job_category, dense_rank()over(partition by job_category order by salary desc) as rn from employees) abc where rn=3 order by employee_id
@echodelta7680
@echodelta7680 3 ай бұрын
Hi Nishtha, 1. If there are more than 1 employee in each dept. having same salary as third highest salary, then what result would your query return? 2. Say, there is a table TRANSACTION having two columns ID and BILL. Table has 100 records, with IDs repeated many times, each ID having different or same bills. Here's a SELECT query to find the avg. bill for each ID over the table : SELECT ID, AVG(BILL) FROM TRANSACTION GROUP BY ID; My question is, does the AVG function run 100 x 100 times, top to bottom scanning one ID at a time? Note that I am not asking about the order of query execution (I know the order). I'm asking how these functions operate on the table rows in the background.
@HARSHRAJ-gp6ve
@HARSHRAJ-gp6ve 3 ай бұрын
simple dense rank question with cte as( select employees.*,DENSE_RANK()OVER(PARTITION BY job_category ORDER BY salary DESC) as x1 FROM employees ) select employee_id,first_name,job_category FROM cte where x1=3;
@theinsightminer08
@theinsightminer08 2 ай бұрын
SELECT employee_id, first_name, job_category FROM (SELECT *, DENSE_RANK() OVER(PARTITION BY job_category ORDER BY salary DESC) as rnk FROM employees) as Ranking WHERE rnk = 3 ORDER BY employee_id;
Swiggy SQL Interview Question | HackerRank Assessment
13:45
Nishtha Nagar
Рет қаралды 9 М.
SQL Interview Question | Capgemini | Data Engineer
6:12
Coding Lake
Рет қаралды 8 М.
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
Capgemini SQL Interview Question 2024 | Transform Rows Into Columns
5:32
Data Science Corner
Рет қаралды 3,8 М.
EY SQL Interview Question | Medium-level
21:33
Nishtha Nagar
Рет қаралды 10 М.
McKinsey SQL Interview Question | Easy Level
13:16
Nishtha Nagar
Рет қаралды 3,8 М.
Target SQL Interview Question | Using Sub-query | Level - MEDIUM
11:16
Spotify SQL Interview Question | Advanced SQL
21:34
Nishtha Nagar
Рет қаралды 1,6 М.
Walmart SQL Interview Question | SQL Window Functions | Advanced
11:31
Meesho SQL HackerRank Question | Medium-Level
15:00
Nishtha Nagar
Рет қаралды 4,2 М.
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН