Тёмный

Hackerrank SQL Solutions | SQL Hackerrank New Companies Medium Problem SOLVED 

The Coding Mentor
Подписаться 4,9 тыс.
Просмотров 9 тыс.
50% 1

Опубликовано:

 

27 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 22   
@randomvariable8680
@randomvariable8680 Год назад
Thank you. you have great calm way of explaining things.
@faisal7828247910
@faisal7828247910 2 года назад
Brilliant solution !!!! Can you please make videos for all the medium level questions of Hacker Rank? It would be really really helpful. 🥺🥺🥺🥺
@thecodingmentor7701
@thecodingmentor7701 2 года назад
Thank u Faisal! :) Sure Thing, find all Problems in my newest Video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-vpzO8QTrgbc.html
@TJ-wo1xt
@TJ-wo1xt 2 года назад
i have one confusion in joins, whenever we want to join two tables assume T1 and T2, and give a LEFT JOIN, which one is the left table, and which one is the right table.
@ahmedibrahim-lr1lj
@ahmedibrahim-lr1lj 2 года назад
its the table that after (from statement)
@thecodingmentor7701
@thecodingmentor7701 2 года назад
Hi TJ, thanks for the great Question! If we write "SELECT ... FROM T1 LEFT JOIN T2 ON ..." then T1 is the left table because it is written BEFORE the LEFT JOIN Statement. T2 is the right table because it is written AFTER the LEFT JOIN Statement.
@Maheshmbathija
@Maheshmbathija 25 дней назад
but why join so many tables, why not just use Employee table and company table. rest are useless, ami right?
@abinashtripathy7044
@abinashtripathy7044 3 года назад
I did not understand why u change the query in 2nd time...1st time query is right only... By the way great work...thanks...
@thecodingmentor7701
@thecodingmentor7701 3 года назад
Hi abinash, I disagree, the 2nd Query is correct, you can see it passing at 25:41. I also did the second query because it is a more general solution than the first one
@jp889
@jp889 3 года назад
Thanks!
@amgdhussein7040
@amgdhussein7040 2 года назад
Why can't I LEFT JOIN all of them based on Company_code since they are all linked to the company code ? Its confusing when more than one foreign key exist
@thecodingmentor7701
@thecodingmentor7701 2 года назад
Hi Amgd, thanks I haven't thought about that! You can do that and it is also the best solution because you are not assuming any relationships of subordinate/superior in the company. Thanks for your input! I published the solution with all tables linked to company code here: github.com/MarkusFriemann/HackerRank/blob/main/New%20Companies
@ifeanyiadika6871
@ifeanyiadika6871 2 года назад
Great Job.
@thecodingmentor7701
@thecodingmentor7701 2 года назад
Thanks!
@hilmitaskn5710
@hilmitaskn5710 3 года назад
7:34 heart attack
@thecodingmentor7701
@thecodingmentor7701 3 года назад
Haha, that made me laugh out loud, thanks for the comment! :D
@chunyanwang527
@chunyanwang527 2 года назад
Can we all use c.companycode = other tables. companycode when we left join all these tables?
@amandubey3041
@amandubey3041 2 года назад
why we need to group by by both code and name?? using only company_code should work but gives error
@mradulagrawal1579
@mradulagrawal1579 2 года назад
Same doubt
@thecodingmentor7701
@thecodingmentor7701 2 года назад
Hi Arman, logically you are right. It depends on what kind of SQL you are using. MSSQL requires you to always Group by all the non-aggregated columns. Because we are printing company_code and founder, we also have to group by these columns. In MySQL the solution would work with only grouping by company_code.
@khalilkassab4546
@khalilkassab4546 Год назад
why left join not just join?
Далее