跳过导航
SQL has levels to it:
0:00 / 1:25

SQL has levels to it:

Zach Wilson

@Zachly5.3万 位关注者

在 X 上查看
917 个赞下载原帖

34,901 次观看

SQL has levels to it: - level 1 SELECT, FROM, WHERE, GROUP BY, HAVING, LIMIT Master these basic keywords and you’ll be well on your way to mastering SQL. - level 2 Mastering JOINs: Most common JOINs: INNER and LEFT Less common JOINs: FULL OUTER Joins you should avoid almost always: RIGHT and CROSS JOIN Mastering common table expressions (CTEs). The WITH keyword defines a CTE which you can imagine as a “variable” that you can query later. Using variables like this you can master algorithm techniques like recursion, breadth first search and more! CTEs also make your SQL much more readable and make your coworkers hate you less compared to nested sub queries. - level 3 Mastering window functions Window functions have 3 pieces: The function (i.e. SUM, RANK, AVG) The over clause to start the window The window definition which has 3 pieces: - how to split the window up with PARTITION BY - how to order the window with ORDER BY - how to restrict the window size with ROWS clause (useful for rolling monthly averages) Understand RANK vs DENSE_RANK vs ROW_NUMBER, I have been asked this in interviews a million times. - level 4 You understand table scans, b-tree indexes, and partitioning schemes to increase performance. Doing something like COUNT(CASE WHEN) is much better than doing multiple queries with a UNION ALL. UNION ALL is terrible for all sorts of reasons that I don’t want to get into in this post. B-trees indexes allow for efficient scanning of data in the WHERE clause. Use explain plans to understand if an index is actually being used or not! Partitioning is similar to indexes except it’s a “poor mans” index. It just keeps data in specific folders and skips the folders that don’t include the data I question. What else did I miss for mastering SQL?

32 条评论

评论来自 X (Twitter) 上的原帖

  • Kwankah Taka 的头像

    @kwankah_taka

    Good breakdown. A few important gaps you didn’t include: * Data modeling (star schema, fact vs dimension tables) * Query design thinking (business question → schema → query plan) * Handling messy data (NULL logic, duplicates, bad joins) * Time intelligence (running totals, lag/lead over time series) * Performance habits (avoiding SELECT *, reducing joins early) Level 4 is also missing the real interview skill: writing correct business queries from scratch under ambiguity.

    4 个赞

  • Pastor Soto 的头像

    @PastorSotoB1

    It might not be as important now, but LLMs will have a hard time figuring out what you need if you don’t know how to ask for the correct query

    2 个赞

  • Aditya Kulkarni 的头像

    @Aadie004

    SQL

    2 个赞

  • Marc Espie 的头像

    @espie_openbsd

    all things I can look up when I need them. SQL is a basic logic puzzle. If you understand logic and programming, spend half a day with a good text and you'll get it.

    1 个赞

  • justfun 的头像

    @me1ajith

    SQL

  • Yaswanth 的头像

    @byash_87

    SQL

  • ThePresident✌️🙌🤓👑 的头像

    @EmperorGbenga

    SQL

  • Tiger 的头像

    @dallasTiger9999

    SQL

  • Marco Guevaraᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠ 的头像

    @marco1996gueva1

    SQL

  • Sàtan 的头像

    @_saytn

    Help yourself and remove that lint from your mic foam

  • Roberto Jimenez 的头像

    @RobertoJC75

    SQL

  • Advett 的头像

    @Advett

    Indexed our sql db check out the speed great video

  • Stephane GRAND 的头像

    @stephane_grand1

    SQL

  • H A R I 🪙 的头像

    @realHariKrishna

    SQL

  • லீ 的头像

    @Vinoth_Lee

    SQL

  • Varun Jain 的头像

    @varunjainnn

    Sql

  • Hooladeemeji 的头像

    @Hooladeemeji

    SQL

  • errrr 的头像

    @Crayon_biro

    SQL

  • Lingeswaran 的头像

    @L1ng3swaran

    SQL

  • Narasimha 的头像

    @NaraAtWork

    SQL