Duke University is offering FREE courses 🔥
💻 Computer Science
🐍 Python
🚀 Machine Learning
📊 Data Science
🕹️ SQL
🤖 Machine Learning Projects
Here are 5 FREE courses to become skilled in 2024
Si hoy clasifica el America, voy a regalar $20,000 entre los RT de este post.
El único requisito es que deben seguirme.
Soy la única persona en X que si dice que va a regalar dinero lo hace. Así que activen las notificaciones de mis posts.
👉 Machine Learning Projects And Tutorials
In this repository you will find tutorials and projects related to Machine Learning.
🔗 https://t.co/REc7VaPkOX
LA CAÍDA del PUENTE en @Edomex
Así caminaba la gente por el puente q va de Nezahualcóyotl @GobNeza a #Chimalhuacan
Y así se partió sobre el canal de aguas negras.
Señor@s, niñ@s, mujeres… todos cayeron.
13 resultaron lesionados.
Había quejas sobre la estructura; nadie atendió!
Want to know the secret to optimizing your SQL queries?
Understanding the execution order is essential.
A SQL query executes its statements in the following order:
1. FROM / JOIN
2. WHERE
3. GROUP BY
4. HAVING
5. SELECT
6. DISTINCT
7. ORDER BY
8. LIMIT / OFFSET
𝗧𝗵𝗲 𝘁𝗲𝗰𝗵𝗻𝗶𝗾𝘂𝗲𝘀 𝘆𝗼𝘂 𝗶𝗺𝗽𝗹𝗲𝗺𝗲𝗻𝘁 𝗮𝘁 𝗲𝗮𝗰𝗵 𝘀𝘁𝗲𝗽 𝗵𝗲𝗹𝗽 𝘀𝗽𝗲𝗲𝗱 𝘂𝗽 𝘁𝗵𝗲 𝗳𝗼𝗹𝗹𝗼𝘄𝗶𝗻𝗴 𝘀𝘁𝗲𝗽𝘀. This is why it's important to know their execution order. 𝗧𝗼 𝗺𝗮𝘅𝗶𝗺𝗶𝘇𝗲 𝗲𝗳𝗳𝗶𝗰𝗶𝗲𝗻𝗰𝘆, 𝗳𝗼𝗰𝘂𝘀 𝗼𝗻 𝗼𝗽𝘁𝗶𝗺𝗶𝘇𝗶𝗻𝗴 𝘁𝗵𝗲 𝘀𝘁𝗲𝗽𝘀 𝗲𝗮𝗿𝗹𝗶𝗲𝗿 𝗶𝗻 𝘁𝗵𝗲 𝗾𝘂𝗲𝗿𝘆.
With that in mind, let's take a look at some 𝗼𝗽𝘁𝗶𝗺𝗶𝘇𝗮𝘁𝗶𝗼𝗻 𝘁𝗶𝗽𝘀:
𝟭) 𝗠𝗮𝘅𝗶𝗺𝗶𝘇𝗲 𝘁𝗵𝗲 𝗪𝗛𝗘𝗥𝗘 𝗰𝗹𝗮𝘂𝘀𝗲
This clause is executed early, so it's a good opportunity to reduce the size of your data set before the rest of the query is processed.
𝟮) 𝗙𝗶𝗹𝘁𝗲𝗿 𝘆𝗼𝘂𝗿 𝗿𝗼𝘄𝘀 𝗯𝗲𝗳𝗼𝗿𝗲 𝗮 𝗝𝗢𝗜𝗡
Although the FROM/JOIN occurs first, you can still limit the rows. To limit the number of rows you are joining, use a subquery in the FROM statement instead of a table.
𝟯) 𝗨𝘀𝗲 𝗪𝗛𝗘𝗥𝗘 𝗼𝘃𝗲𝗿 𝗛𝗔𝗩𝗜𝗡𝗚
The HAVING clause is executed after WHERE & GROUP BY. This means you're better off moving any appropriate conditions to the WHERE clause when you can.
𝟰) 𝗗𝗼𝗻'𝘁 𝗰𝗼𝗻𝗳𝘂𝘀𝗲 𝗟𝗜𝗠𝗜𝗧, 𝗢𝗙𝗙𝗦𝗘𝗧, 𝗮𝗻𝗱 𝗗𝗜𝗦𝗧𝗜𝗡𝗖𝗧 𝗳𝗼𝗿 𝗼𝗽𝘁𝗶𝗺𝗶𝘇𝗮𝘁𝗶𝗼𝗻 𝘁𝗲𝗰𝗵𝗻𝗶𝗾𝘂𝗲𝘀
It's easy to assume that these would boost performance by minimizing the data set, but this isn’t the case. Because they occur at the end of the query, they make little to no impact on its performance.
If you want to create efficient queries, it's a good idea to understand how things work under the hood otherwise your efforts may be wasted. While these tips work best in most cases, you should consider your unique use case when choosing the best course of action.