• abhibeckert@lemmy.world
    link
    fedilink
    arrow-up
    26
    arrow-down
    4
    ·
    edit-2
    11 months ago

    Stage 5 can give you a huge boost in writing complex queries!

    You say that like it’s a good thing. I like my queries simple.

    Also - the stuff you have under “stage 6” should all be learned before “stage 2” in my opinion. Knowing how to write efficient queries is far more important than group by / join / etc.

    • fmstrat@lemmy.nowsci.com
      link
      fedilink
      English
      arrow-up
      13
      ·
      11 months ago

      Huh? How do you write an efficient query and not take into account joins? A single table query? Are you a Prisma fan?

    • Lmaydev@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      11 months ago

      Joining is one of the simplest and most useful things in SQL.

      How can you possibly query without it?

      Simple queries are obviously better but not everything can be achieved with simple selects.

  • mvirts@lemmy.world
    link
    fedilink
    arrow-up
    17
    arrow-down
    1
    ·
    11 months ago

    I feel like the word “partitions” used in this article should be “window functions”

    • GBU_28@lemm.ee
      link
      fedilink
      English
      arrow-up
      3
      ·
      11 months ago

      Good point. Window functions are mandatory knowledge for intermediate users

  • AngryishHumanoid@reddthat.com
    link
    fedilink
    arrow-up
    15
    ·
    11 months ago

    I imagine it depends on use case. Anything more advanced that subqueries/CTEs is largely the domain of ETL developers (not exclusively, obviously) but most others using SQL don’t need anything that advanced.

  • GBU_28@lemm.ee
    link
    fedilink
    English
    arrow-up
    12
    ·
    11 months ago

    CTEs enhance readability, documentation, and testing imo. I’m very pro CTE whenever a subquery isn’t the obvious choice.

  • howrar@lemmy.ca
    link
    fedilink
    arrow-up
    9
    ·
    11 months ago

    It’s always bothered me when I write subqueries that have to be run on each row. Good to know that there’s a better way.

  • Lmaydev@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    11 months ago

    CTEs are amazing. I discovered them semi recently and it’s such a great tool to have in your belt.

    Partitioning is definitely something I need to work on.