Skip to content

Latest commit

 

History

History
28 lines (17 loc) · 1.72 KB

README.md

File metadata and controls

28 lines (17 loc) · 1.72 KB

A Journey with SQL

𝗦𝗤𝗟 𝗾𝘂𝗲𝗿𝗶𝗲𝘀 𝗿𝘂𝗻 𝗶𝗻 𝘁𝗵𝗶𝘀 𝗼𝗿𝗱𝗲𝗿

We utilize SQL queries to access a collection of records that are stored in our database tables. Clauses are the building blocks of SQL queries. To get the right outcomes, these clauses must be executed in a specific order. SQL query execution order is the name given to this sequence of operations.

𝗦𝗤𝗟 𝗾𝘂𝗲𝗿𝘆 𝗲𝘅𝗲𝗰𝘂𝘁𝗶𝗼𝗻 𝗼𝗿𝗱𝗲𝗿 refers to how the query clauses are evaluated in accordance with the requirements or how to optimize database search results. We use clauses in a specific order known as the SQL query execution order, similar to how we plan something step by step and arrive at the end result.

Here is the 𝗼𝗿𝗱𝗲𝗿 𝗶𝗻 𝘄𝗵𝗶𝗰𝗵 𝘁𝗵𝗲 𝗦𝗤𝗟 𝗰𝗹𝗮𝘂𝘀𝗲𝘀 𝗮𝗿𝗲 𝗲𝘅𝗲𝗰𝘂𝘁𝗲𝗱:

  1. 𝗙𝗥𝗢𝗠 - tables are joined to get the base data.
  2. 𝗪𝗛𝗘𝗥𝗘 - the base data is filtered.
  3. 𝗚𝗥𝗢𝗨𝗣 𝗕𝗬 - the filtered base data is grouped.
  4. 𝗛𝗔𝗩𝗜𝗡𝗚 - the grouped base data is filtered.
  5. 𝗦𝗘𝗟𝗘𝗖𝗧 - the final data is returned.
  6. 𝗢𝗥𝗗𝗘𝗥 𝗕𝗬 - the final data is sorted.
  7. 𝗟𝗜𝗠𝗜𝗧 - the returned data is limited to row count.

SQL Query Run Order

Preview - 01

drawing

Preview - 02

drawing