In the Joins versus Subqueries: Which Is Faster? blog article we learned that joins tend to execute faster than subqueries. Having said that, it's not a universal rule, so you may not want to automatically assume that a join will be preferable. As mentioned in that article, if you need to add many joins to a query, the database server has to do more work, which can translate to slower data retrieval times. This article will present a couple of quick tests you can perform to compare a query that employs joins to one that contains subqueries so that you can choose which performs best.
Back in 2020, we learned about The NULL Value and its Purpose in Relational Database Systems. As stated in that article, the value NULL has become a special marker to mean that no value exists. You could also say that NULL values may indicate that a column could have a value, but you don't know what that value should be yet. In that context, they act as a placeholder until you finally collect the data needed to fill the table field with a real value.
Moreover, when you consider that all major database vendors support NULLs as default values, it only makes sense to use them, doesn't it? Well, not so fast. There are database designers who avoid using NULLs unless absolutely necessary. Do they know something that the rest of us don't? Read on to find out!
Although there are few database administrators (DBAs) who do not believe in performing regular database backups, there are many opinions on how best to do so. Whichever approach you espouse, there are many good reasons to keep a copy of the database schema. In the event of data loss, you can restore the database structure from the schema, and then populate it with the latest data backup.
Some database vendors, such as MySQL, offer free utilities (i.e. mysqldump) for backing up the database structure on its own, while others require a specific administration tool to do so. If you're a Navicat user, there's no need for external tools. While data backups may be performed using the Backup Wizard, the schema can be copied using the Data Transfer Tool. In this blog, we'll learn how!
Last week's article shed some light on the Outer Joins in SELECT queries. It's a JOIN type that returns both matched and unmatched rows from related tables. Unfortunately, it is not supported by all database (DB) vendors, including MySQL. But that's OK, because Outer Joins can be emulated by combining three other JOIN types, namely LEFT, INNER, and RIGHT joins. In this article, we'll learn more about LEFT and RIGHT joins and how, when combined with an INNER JOIN, they create an OUTER JOIN.
The Outer Join is the least understood of all the SQL Join types. Perhaps it's because Outer Joins are required somewhat less often than other join types. In any case, there is nothing inherently strange about Outer Joins. As we'll see in this blog article, a few examples of the Outer Join in action should be enough to clarify any misapprehensions and/or confusion you may have about them.
This blog will first describe the syntax and purpose of the Outer Join statement, which will then be followed by some illustrative examples.
- 2024 (1)
- 2023 (1)
- 2022 (1)
- 2021 (1)
- 2020 (1)
- 2019 (1)
- 2018 (1)
- 2017 (1)