Stop Using Inner Joins!

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • Do you really need an inner join there? In this video I will discuss a common misuse of inner joins.

Комментарии • 38

  • @passportbro904
    @passportbro904 2 месяца назад

    Im just proud of myself that i started learning sql 2 weeks ago and i understand about 95% of what ur talking about. Goals

  • @juslee746
    @juslee746 3 года назад +2

    Awesome video! Definitely changing how I am going to be approaching problems. Keep these coming please!!!! ...

  • @AndrewJens
    @AndrewJens Год назад +3

    With a bit of design work (e.g. referential integrity constraints between the Sales and Country tables), the "AU" data won't be able to be missing. Then the inner join will always work fine. Whether that is done or not depends on other factors, e.g. the number of records in the tables.
    The trouble with the approach in the video is that other statistics can become misleading, e.g. a query reporting the total sales from Australia.

    • @JamesOliver
      @JamesOliver  Год назад +1

      The only issue with referential integrity is that as a developer you might not know if it exists. It is a good point regrarding AU sales. I suppose I could have chosen a better example to illustrate the point.

  • @garisoncyr6696
    @garisoncyr6696 4 года назад

    Great Video! Short, concise, and providing unique content. You are not going to find this kind of thing all over the internet. Glad I found your videos!

    • @JamesOliver
      @JamesOliver  4 года назад

      Glad you enjoy! Thank you! :)

  • @iliashterev38
    @iliashterev38 7 месяцев назад

    I learned this the hard way when I was pulling customers and comments. Inner join would not pull customers without a comment.

  • @bujin1977
    @bujin1977 11 месяцев назад +1

    Seems like a bit of an odd one, this. It seems like the sort of thing even a beginner should understand. If I was to interview and test a junior SQL developer for a job (something I'll be helping to do within the next couple of months) and they didn't know this, I would be very hesitant to employ them! Your statement about this sort of thing separating an expert or a true professional from a novice or intermediate developer just seems way off!

  • @prabhaker9031
    @prabhaker9031 3 года назад

    Good one man. Optimization is much needed !!

  • @leopatrick7671
    @leopatrick7671 2 года назад

    Really Helpfull :)
    I am glad that i found this channel

  • @nonefvnfvnjnjnjevjenjvonej3384
    @nonefvnfvnjnjnjevjenjvonej3384 4 года назад +2

    This is so good. Expert level Sql RUclipsrs are so hard to come by. Subscribed. Also if I may, can you do some more Sql challenges where you solve hard problems using expert Sql. I would really love to learn and watch those. I really love Sql.

  • @demba1955
    @demba1955 Год назад

    Really interesting James, thanks for that 👏🏽

  • @prasadj8676
    @prasadj8676 4 года назад

    Loved it. I never thought of this before... Thanks mate.

  • @sasstemir
    @sasstemir Год назад

    Never ever ever expect complete high quality data in your database. I learned it the hard way

  • @R3V0_777
    @R3V0_777 6 месяцев назад

    Outstanding video! Thank you!

  • @rabahakrour3688
    @rabahakrour3688 4 года назад +2

    you are the best ! thnx !!
    I will never use inner join in my life again 😭 .... just kidding

  • @maximessina9999
    @maximessina9999 3 года назад

    Hahhahahah the ending made me laugh a lot. Great video, thnx for the lesson.

  • @hadireg
    @hadireg 4 года назад

    one needs to know the biz rules and how tables are tied together. otherwise, yeah you better know why using an inner join ;-) Great video mate!

  • @JosephItopaAbubakar
    @JosephItopaAbubakar Год назад

    I felt so guilty the way he said, "I think you are using too many inner join".

  • @PitZza143
    @PitZza143 Год назад

    Well Played

  • @ankurlodha6098
    @ankurlodha6098 3 года назад +2

    hey James, your videos are amazing. Do you mind covering scenarios on where to use group by vs window function. sometimes we run in situations where the output can be achieved using either approach. I know from a performance perspective group by is more efficient however since window functions are easier to read and write I always start with window function I need to break this mental block of mine and therefore if you can go through this topic that would be highly appreciated. Again thanks for all the amazing videos.

  • @emmanuelaolaiya
    @emmanuelaolaiya 3 года назад

    Great perspective and thanks for sharing

    • @JamesOliver
      @JamesOliver  3 года назад

      You're very welcome. Thanks for watching! :)

  • @bisratgezahgne914
    @bisratgezahgne914 4 года назад

    Thank you, Oliver.

  • @mishasawangwan6652
    @mishasawangwan6652 4 месяца назад

    no disrespect because you raise an important fact about joins. that said…
    you should have specified that this is most relevant when a target column is nullable; eg country code in this example.. otherwise if it’s non nullable the outer join is pointless.
    also this is like one of the first hard lessons you learn when you start writing real queries.

  • @vincepeterson2834
    @vincepeterson2834 3 года назад

    Good thoughts.

  • @palanit4191
    @palanit4191 4 года назад

    Thanks for the video. By default the mstr reports does a inner join between fact and dimension tables, so is it advised to change this behavior ?

    • @JamesOliver
      @JamesOliver  4 года назад +1

      That depends on the nature of your data. In this video I was mainly referring to manually written queries but take a look at my video "All about outer joins". In there I talk about that as it relates to Mstr. As a quick example, I recently worked with data where many of the attributes values could be "blank" in the fact tables so in this case I changed the behavior to outer join because I didn't want to drop rows just b/c an attribute was not populated. Now, if this is common throughout your data, then it might make sense to change the project behavior but if this is only the case for a few attribute then I would leave the project behavior as is and just change the attribute join behavior.

    • @palanit4191
      @palanit4191 4 года назад

      @@JamesOliver Expecting quick byte videos like these from time to time. Thanks.:-)

  • @Esp1fs
    @Esp1fs 3 года назад

    Yeah! Programmers should never have inner join! Outer the better

  • @MrSarath06
    @MrSarath06 2 года назад

    You are master 😎

  • @Rajeshkumar-wu9ih
    @Rajeshkumar-wu9ih 4 года назад

    Hi oliver sir...I am watching your microstrategy videos...very good videos sir. Thanks sir. Please put a video for how to validate microstrategy report..my English is not good..please understand..🙂🙂

  • @hovardlee
    @hovardlee 3 года назад

    I have SQL in my blood :) So it is about data integrity. If you do not have country in dictionary so you have problem beceuse this is being used probably in a dozen of queries.

  • @sgpleasure
    @sgpleasure 3 года назад

    eh! Of-course, Left Joins are the most commonly used. Need to really shows us more 'advanced' tips.

  • @Helloimtheshiieet
    @Helloimtheshiieet Год назад

    Thank god 😂 the fact I have to explain how stupid it is to use inner joins in the real world is so sad. I use left nested
    Joined 99% of the time