Some Disadvantages of Allowing Null Values in Relational Databases (2024)

Some Disadvantages of Allowing Null Values in Relational Databases

Nov 07, 2022 by Robert Gravelle

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 NULL values represent "nothing" or "no value", they are treated as a value by the database. As such, they take up space on the hard drive. So, if you think that you are saving hard drive space by employing NULL values, you could be mistaken. In fact, NULL is considered to be a variable-length value, meaning that it could be a few bytes or several bytes, depending on the column type. The database leaves room for extra bytes should the value be larger than what is stored in the field, the result being that your database might take up more hard drive space than if you had used regular values.

Some database administrators argue that if all the columns of a record can't be filled, then a record shouldn't be created. This argument obviously doesn't apply to all use cases, but the idea behind it is that a record should only be created when all fields have actual values without any placeholders. For example, in a banking application, you wouldn't proceed with a transaction if you didn't know the amount of the transaction. Fair enough, but this type of rigorous standard doesn't work so well in other industries such as e-commerce or websites that collect user data.

Another disadvantage affects your database stored procedures. While most databases provide functions to detect NULL values, special care must still be taken to distinguish NULLs from other values. This means that your SQL procedures might be much longer than necessary, and they can become complex to read as well. A database administrator may reject code changes if the procedures are too convoluted and/or unintelligible.

Case in point, here's a small table in Navicat Premium 16 that contains a combination of values, empty strings, and NULLs:

Some Disadvantages of Allowing Null Values in Relational Databases (1)

In Navicat, it's easy to insert an empty string or NULL via the Edit menu.

Now here's a query that counts the number of names based on a variety of criteria:

Some Disadvantages of Allowing Null Values in Relational Databases (2)

We were looking for a count of 5 as records 4, 5, 7, 8, and 10 do not have values in them. However, only the combo_count returned 5. This is because while a NULL value does NOT have a length, so NULLs are not picked up by the length() function.

From this example, we can conclude that allowing NULL values can make you work extra hard to get at the kind of data you are looking for. Moreover, allowing NULL values may reduce your confidence regarding the data in your database, as you can never quite be sure whether a value exists or not.

Most database practitioners choose to allow some NULL values in their database tables, as they are the default value in just about any well known database and function well as a placeholder for missing data. On the other hand, we saw here that some DBAs don't feel that NULLs are worth the extra trouble they entail. The moral of this story is that you should consider your own business processes before designing your database(s) and choose a structure that best suits your data.

Some Disadvantages of Allowing Null Values in Relational Databases (2024)
Top Articles
Increased Limits for Fiat Wallets | Crypto.com
7 Ways to Get Free Bitcoin Fast and Legit
Exclusive: Baby Alien Fan Bus Leaked - Get the Inside Scoop! - Nick Lachey
Melson Funeral Services Obituaries
Restored Republic January 20 2023
Pike County Buy Sale And Trade
Back to basics: Understanding the carburetor and fixing it yourself - Hagerty Media
123 Movies Babylon
Anki Fsrs
Where's The Nearest Wendy's
Helloid Worthington Login
REVIEW - Empire of Sin
WWE-Heldin Nikki A.S.H. verzückt Fans und Kollegen
Meritas Health Patient Portal
Used Drum Kits Ebay
Jesus Calling Oct 27
Chastity Brainwash
Craigslist Free Stuff Santa Cruz
Dark Chocolate Cherry Vegan Cinnamon Rolls
Odfl4Us Driver Login
Msu 247 Football
Kayky Fifa 22 Potential
Fsga Golf
Ice Dodo Unblocked 76
8005607994
Aspenx2 Newburyport
Lines Ac And Rs Can Best Be Described As
Elbert County Swap Shop
Acurafinancialservices Com Home Page
Panolian Batesville Ms Obituaries 2022
Pokemon Inflamed Red Cheats
Delta Math Login With Google
Syracuse Jr High Home Page
Gideon Nicole Riddley Read Online Free
Muma Eric Rice San Mateo
Giantess Feet Deviantart
1v1.LOL Game [Unblocked] | Play Online
Gvod 6014
Noaa Marine Weather Forecast By Zone
How Does The Common App Work? A Guide To The Common App
Payrollservers.us Webclock
Love Words Starting with P (With Definition)
Cch Staffnet
Sky Dental Cartersville
17 of the best things to do in Bozeman, Montana
Here’s What Goes on at a Gentlemen’s Club – Crafternoon Cabaret Club
El Patron Menu Bardstown Ky
Immobiliare di Felice| Appartamento | Appartamento in vendita Porto San
Costco Tire Promo Code Michelin 2022
Chitterlings (Chitlins)
When Is The First Cold Front In Florida 2022
Mazda 3 Depreciation
Latest Posts
Article information

Author: Fr. Dewey Fisher

Last Updated:

Views: 6283

Rating: 4.1 / 5 (62 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Fr. Dewey Fisher

Birthday: 1993-03-26

Address: 917 Hyun Views, Rogahnmouth, KY 91013-8827

Phone: +5938540192553

Job: Administration Developer

Hobby: Embroidery, Horseback riding, Juggling, Urban exploration, Skiing, Cycling, Handball

Introduction: My name is Fr. Dewey Fisher, I am a powerful, open, faithful, combative, spotless, faithful, fair person who loves writing and wants to share my knowledge and understanding with you.