SQL Interview Questions and Answers Series | HackerRank | SYMMETRIC PAIRS | Advanced Join

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

Nishtha Nagar

Nishtha Nagar

Күн бұрын

Пікірлер: 18
@badrilalnagar9232
@badrilalnagar9232 7 ай бұрын
I hope that you will get success to your channel.
@vitorcastro42
@vitorcastro42 7 ай бұрын
Can anyone explain to me why my solution does not work? with Functions_symmetric as ( select Functions.y as x2, Functions.x as y2 from Functions ), Joined_tables as ( select Functions.x, Functions.y, Functions_symmetric.x2, Functions_symmetric.y2 from Functions inner join Functions_symmetric on Functions.x = Functions_symmetric.y2 and Functions.y = Functions_symmetric.x2 ) select distinct x, y from Joined_tables where x
@pujankoshti9589
@pujankoshti9589 7 ай бұрын
why you did GROUP BY X,Y in where clause?. what is the use of that?
@datasciencewithnish
@datasciencewithnish 7 ай бұрын
General Context - We use the GROUP BY clause to categorize data before applying the HAVING clause. The GROUP BY clause groups rows together based on shared values in one or more columns. The HAVING clause then filters these groups based on a condition applied to aggregate functions (e.g., COUNT) in this case. Generally, HAVING allows filtering based on aggregate values, which aren't available until after the data is grouped. For instance, here you can't filter for symmetric pairs with a "COUNT > 1" until the rows are grouped and the count is calculated. So, we've used the GROUP BY just to segregate the pairs.
@frezerzelalem4017
@frezerzelalem4017 6 ай бұрын
@@datasciencewithnish as a follow up, why didn't you used x1
@Anonymous____________A721
@Anonymous____________A721 4 ай бұрын
Why not cross join
@Mahanthesh.
@Mahanthesh. 7 ай бұрын
Amazing madam
@shashanksingh4708
@shashanksingh4708 5 ай бұрын
Thanks for sharing your solution . Have a look at mine : select distinct f1.x , f1.y from functions f1 join functions f2 on f1.x=f2.y and f1.y=f2.x where f1.x
@rajeshin1
@rajeshin1 4 ай бұрын
Other way can be like this too right select distinct f1.x , f1.y from functions f1 join functions f2 on f1.x=f2.y and f1.y=f2.x where f1.x1 ) order by f1.x;
@palnitin25
@palnitin25 6 ай бұрын
Thank you for this Nishtha
@SumanSadhukhan-md4dq
@SumanSadhukhan-md4dq 6 ай бұрын
This is nice
@YogeshChaudhary-s8y
@YogeshChaudhary-s8y 5 ай бұрын
as a follow up, why didn't you used x1
@harshitgiria7709
@harshitgiria7709 5 ай бұрын
Did you understand why it's happening? Could you please let me know?
@coc3311
@coc3311 5 ай бұрын
okey actual problem is that when you use x1
@harshitgiria7709
@harshitgiria7709 5 ай бұрын
@@coc3311 Yeah Got it ...Thank You for the explanation.
@lalitranaiitan
@lalitranaiitan 6 ай бұрын
cool
@YogeshChaudhary-s8y
@YogeshChaudhary-s8y 5 ай бұрын
as a follow up, why didn't you used x1
@tanmaynagrale4595
@tanmaynagrale4595 4 ай бұрын
Same doubt
ССЫЛКА НА ИГРУ В КОММЕНТАХ #shorts
0:36
Паша Осадчий
Рет қаралды 8 МЛН
The 25 SQL Questions You MUST Know for Data Analyst Interviews
32:47
KSR Datavizon
Рет қаралды 258 М.