Hi, Thought of registering for your sql course but couldnt find a link Could you please help me on this
@parvchopra1456 Жыл бұрын
hii sir hope you are doing well sir could you please make a video or could you please tell ,how to master SQL ?
@sujaa100010 ай бұрын
One of the best KZbin channel for SQL! Thanks TFQ!
@zewduwereta302 Жыл бұрын
Very interesting problem! I like the way you dissect the problem into different parts, it makes easier to approach it! Thanks!👍👍
@Madhusudan_Sarkate Жыл бұрын
Best explanation ever hard problems look like simple
@560FarazAhmad Жыл бұрын
JazakAllah. Very convenient solution to a complex problem. May Allah bless you.
@techTFQ11 ай бұрын
Thank you very much 😊
@attilapekkaszabo-iv6tl Жыл бұрын
Best tutor for SQL, easy to follow and very detailed explanation. Must follow and subscribe if you want to solve interesting SQL problems.
@Samcrazy4u Жыл бұрын
Thanks toufiq Bhai, for helping Data community and and sharing knowledge & experience 😊, it helps a lot to understand self join
@SrikanthSSSSSS Жыл бұрын
Thank you sir, I developed my SQL with your videos only
@JordanTambeck Жыл бұрын
great video as always, it was well explained.
@avi8016 Жыл бұрын
Great explanation of self join Thankyou sir for this video!
@reachbharathan Жыл бұрын
I think this problem should be the best example for demoing the usecase for self join
@krantikumar894 Жыл бұрын
Self join is the best way to answer this question
@ashu7863 Жыл бұрын
Please share this session also
@Manzur.A Жыл бұрын
You are the BEST!
@AviralOjha Жыл бұрын
May Allah always be by your side my brother. You are like one of his greatest blessings on 🌎❤ The way you have explained and brought the best solution out is commendable! Ankit Bansal makes things over complicated, neither do I enjoy his style of teaching. We are meant to learn from you!
@techTFQ11 ай бұрын
Thank you very much brother 😊 All the best
@soundarsswag7386 Жыл бұрын
Select count(1) from person a Where status =Alive And exists ( select 1 from persons Where a.parent = b. Person)
@venkeenkokku Жыл бұрын
This correlated sub-query will yield the result as required --- select c.person from persons c where exists ( select null from persons p where c.parent = p.person and exists ( select null from persons g where g.person= p.parent and g.status = 'Alive'))
@fathimafarahna2633 Жыл бұрын
Great video again 👍👍
@gontlakowshik2345 Жыл бұрын
We can use self join
@Ujjwalmishra-t1w2 ай бұрын
Nice questions
@Krishna48784 Жыл бұрын
Thank you for sharing, nice explanation. When will you start postgresql Boot camp
@reachbharathan Жыл бұрын
Thanks a lot , I understood everything, great explanation, i question what the last part select count( 1) , are we doing a grouping?
@vinodlondhe-cm8lz11 ай бұрын
Your great sir
@sachingunjal7347 Жыл бұрын
hope this solution is acceptable -- select P1.person as self, P2.person as Parent, P3.Person as GP, P1.person_status as GP_Status from Persons as P1 Right join Persons as P2 on P1.parent = P2.Person right join Persons as P3 on P2.parent = P3.Person where P1.person_status = 'Alive'
@santhoshkumar6760 Жыл бұрын
Solved the same kind of problem with scenario employee, manager, managers_ manager using self join
@santhoshkumar6760 Жыл бұрын
N i loved the way of explanation, it's giving interest more n more Thanks
@Orkhan-w5r6 ай бұрын
Thank you, very useful video. I have a similar task but with more than 10 levels of hiereachy. Not sure if this is a good idea to use self join more than 10 times. Any suggestions?
@matthias75344 ай бұрын
Cde with recursive select query
@matthias75344 ай бұрын
He made a video on it as well kzbin.info/www/bejne/gouqkoWZed2dbqs
@aravindt1596 Жыл бұрын
Hi I want to triggers in postgresql
@aimanansarmomin454211 ай бұрын
I am not from technical background but learning sql. When we open list of the tables ,I am not able to find the parent table among all tables please guide me on this..
@ParhamFarjam-n3b Жыл бұрын
Hello, Would you please solve quastion like this for python(panda)?
@swethaveluguri9115 Жыл бұрын
I'm facing a SQL interview question repeateadly. "Why a stored preocedure is executing fine till yesterday and today it is taking long time to execute" [indexes are not dropped/no changes to this query]. Can you please explain this question ?
@venkeenkokku Жыл бұрын
Either data in the table got added over period of time, which caused underlying data distribution change OR Failure to refresh to stats on regular basis OR both
@CheatingStoriesWithChinwe Жыл бұрын
Tfq makes sql look so simple
@azalieysakova10 ай бұрын
thanks a lot!!!!!!!
@sameerambre2696 Жыл бұрын
I am not sure whether I am right here but, this is what I understand. Parent of B is Y and Y's grandparent is Y1 and the status of Y1 is Alive. Can you please help me understand why that record is not coming in your result set?
@PriyankaVijay-pm1wc6 ай бұрын
I hope you are checking the status of y1 in parent table. You should see y1 status from name of person then check the status of the person . X1 is alive and y1 is dead
@throughmyglasses9241 Жыл бұрын
with recursive parents as ( select person,parent,CAST(NULL as varchar(10)) as son, 1 as level from people where person not in (select parent from people) union all select p2.person,p2.parent,p1.person,level+1 from parents as p1 inner join people as p2 on p1.parent=p2.person where p2.status='Alive') select count(*) from parents where level>=3;
@nivisworld1513 Жыл бұрын
sir.....please post sql classes from scratch......you said will post 1st week of September but not posted......please sir post those classes.......
@swapnilsolanki8595 Жыл бұрын
Another way of writing query for same problem with recursive cte1 as ( select * from test where par_name in (select p_name from test) ), cte2 as ( select *, 1 as level from cte1 union select c1.*, level + 1 as level from cte1 c1 join cte2 c2 on c2.par_name = c1.p_name ) select count(1) from ( select cte2.p_name, cte2.par_name, t.status from cte2 join test t on cte2.par_name = t.p_name where level = 2 and t.status = 'Alive' ) subquery
@rishabhgupta1029 Жыл бұрын
with table_A as ( select t1.*, t2.parent as grand_parents from persons as t1 left join persons as t2 on t1.parent = t2.person ) select count(*) from table_A as t1 left join persons as t2 on t1.grand_parents = t2.person where t2.person_status ='Alive' ;
@krishnakumarkumar5710 Жыл бұрын
Query solving with Odni school ad
@Rajendra-b6t4 ай бұрын
SELECT count(1) FROM persons c JOIN persons P ON p.PERSON = c.parent join persons GP on GP.PERSON = p.parent where GP.person_status = 'Alive'
@palbabu33 Жыл бұрын
posting before watching your solution: SELECT C.PERSON AS CHILD, C.PARENT AS PARENT, P.PARENT AS GPARENT, GP.PERSON_STATUS FROM STATUS C JOIN STATUS P ON C.PARENT = P.PERSON JOIN STATUS GP ON P.PARENT = GP.PERSON WHERE GP.PERSON_STATUS = 'ALIVE';
@sreejeshjnair6755 Жыл бұрын
Self join is a solution
@varuntirupati2566 Жыл бұрын
select count(p.person) as persons from persons p inner join persons gp on p.parent = gp.person inner join persons gp2 on gp.parent = gp2.person where gp2.person_status = 'Alive';
@anudeepreddy5559 Жыл бұрын
Plsql bootcamp please
@satyamace Жыл бұрын
I don't know why my one line code is working perfectly: select person from persons where parent in (select person from persons where parent in (select person from persons where person_status='Alive'));
@vrajsomeshvari3825 Жыл бұрын
great
@techTFQ11 ай бұрын
SQL Server problem solving
@HARSHRAJ-wz2rp4 ай бұрын
select * from persons; with cte as( select P2.person,P1.parent as "Grandfather" FROM persons P1 JOIN persons P2 ON P1.person=p2.parent ) select COUNT(*) FROM cte JOIN persons ON cte.Grandfather=persons.person where person_status="Alive"; hoto gaya per kaise gaya woh nahi pata
@KoushikT Жыл бұрын
################ My Solution using CTE ################ with A as ( select p1.person as person, p2.parent as grandparent from persons p1 join persons p2 on p1.parent=p2.person) select count(A.person) as alive_count from A join persons p on A.grandparent = p.person where p.person_status='Alive'
@vishalsonawane.890510 ай бұрын
Done
@DeanMarko-ex3rd Жыл бұрын
Not be annoying but this is a dumb question. But I love your videos
@cartercordingley6062 Жыл бұрын
I use a question like this but with an org chart. And I throw in n levels. Of find all employees under the CSO This question let me know if they can understand how to loop through an unknown amount of data. A lot of people will not use loops and just use joins, which is incorrect. But if they use recursive cte, cursor, or even pass it to a CLR or other program like Python or a C# to do a loop, they pass.
@TheAbhisai Жыл бұрын
Natural joins
@shashigowdar7359 Жыл бұрын
self join
@ChanduMuddasani Жыл бұрын
Please explain slow and clear I didn't understand this vedio
@viswaskumarsurapaneni72 Жыл бұрын
Slefjoin a 1 with a2 on a1.person =a2.parent
@abir95571 Жыл бұрын
You’ll have to do 3 self joins as the live status is on person not parent.