instead of l1.user_id < l2.user_id we can write l1.user_id !=l2.user_id so that we do not have to union the table at the end
@derek713Ай бұрын
I don't think this works, this method means you will have to union friendship table within the "where clause" ......... where (u1.user_id,u2.user_id) not in (select user1_id,user2_id from friendship union select user2_id,user1_id from friendship) group by u1.user_id, u2.user_id, u1.day,u2.day having count(*)>=3 )
@hassamulhaq77623 ай бұрын
because of previous sql videos I easily understand thelogic he used to write queries in this video. really thanks for such educational video.
@maradanaajaykumar36573 ай бұрын
Please do more leet code problems bro it helps us to understand complex problems
@anonymousgreen50803 ай бұрын
Sir leetcode sql premium questions are difficult. Would appreciate few more videos on this topic.
@shafaligarg17963 ай бұрын
He's crazy talented man 🤯 kudos
@jirikalina18903 ай бұрын
You should definitely do another. Very good content Sir.
@vikaskumar-oj2fr3 ай бұрын
Your database skills are great 👍
@GarvitaSaraswat-t9r3 ай бұрын
looking forward to more such videos! thanks in advance!
@deepakdas451318 күн бұрын
crystal clear explanation 👍
@sujaa10003 ай бұрын
Thank you very much! very very helpful. Look forward to more such problems.
@iamdushyanta3 ай бұрын
Could you please do more leet code problems?
@RRR56703 ай бұрын
sir please come up with a series❤
@mainsocial11052 ай бұрын
Really enjoyed this video!! Thanks :)
@roz_world3 ай бұрын
@techtfq sir please leetcode SQL problem solution series please
@FabioAlmeida-k6t3 ай бұрын
well illustrated and explained
@saadmultani72513 ай бұрын
Please do more leetcode complex problem
@lio-s4n73 ай бұрын
Nice. Be posting leetcode solutions for sql.
@mohansai91093 ай бұрын
Please do more leet code problems
@rohit_vora3 ай бұрын
hello everyone , i am having a tiny problem while writing query , if anyone could help me that would be so great. so, when i write query and press enter to go to next line, it automaticaly add some space at the begining which i don't want for ex: (select * from abc where aaa group by bbb) somthin like this. if anyone knows what settings should i chaneg to write just like sir writing in the video, i would be so greatfull to you.
@adesholaolaitan22573 ай бұрын
Please which tool are you using to record your screen?
@bestquotes27653 ай бұрын
It's a good approach, but have one doubt do we need the valid_user cte?. Because we are anyway filtering it using having in a freinds cte.
@sunetala29572 ай бұрын
How to FCFS for insert or update in code sql😢
@JoelJeremiah-v5t3 ай бұрын
For what roles are such questions asked in the interview, sir?
@Naveenvuppala3 ай бұрын
When you understand the logic and know the cte logic it's like playing game
@MohdSaeed-g6l3 ай бұрын
Sir, I am clicking this question then require subscribe to unlock. Can you suggest me how it will open.
@marrapumani3 ай бұрын
sir try to make videos on transactions and cursors
@shadeditz1813 ай бұрын
sir do you have any paid course of sql
@Malaika_ki_rahein3 ай бұрын
sir please teach transaction management with real world exampless
@arunsam68303 ай бұрын
Can any one suggest a playlists for Terraform for IAC?
@rajeshmajumdar49993 ай бұрын
Champion !!!
@Mr.nikk623 ай бұрын
Hii sir thanku for this quality video but sir i have a big question to solve in SQL sir there any way to connect with you and tell you the problem and other student also learn form the question Kindly provide me the way to connect with you
@Malaika_ki_rahein3 ай бұрын
please teach us by reference of KORTH BOOK
@haleylearn2 ай бұрын
Here my solution WITH cte AS ( SELECT l1.user_id AS user_id1, l2.user_id AS user_id2, COUNT(l2.user_id) AS cnt FROM listens l1 JOIN listens l2 ON l1.user_id l2.user_id AND l1.song_id = l2.song_id AND l1.day = l2.day GROUP BY l1.user_id, l2.user_id HAVING COUNT(l2.user_id) >= 3 ) , cte_concat_listen AS ( SELECT *, CASE WHEN user_id1 < user_id2 THEN CONCAT(user_id1, user_id2) ELSE CONCAT(user_id2, user_id1) END AS concat_userid FROM cte ) -- Result SELECT user_id1 AS user_id, user_id2 AS recommended_id FROM cte_concat_listen WHERE concat_userid NOT IN (SELECT CONCAT(user1_id, user2_id) AS concat_friend FROM friendship) ORDER BY user_id1;