Skip to content Skip to sidebar Skip to footer

Android & Sqlite: Will A Blank Row Cause Any Database Issues?

I have a number of EditTexts on a UI where the user inputs data. The data is saved in a SQLite database. The user can leave some of the EditTexts blank (no data entered). I confi

Solution 1:

For the integrity of the database, it is conceptually better to not set a value for the column or otherwise set it to null. Null indicates no value is set and in this case the user did indeed provide no value. Using null gives you a clear indication that no value has been provided and is easier to check for in SQL queries. Storing an empty string also uses storage space that null does not.

This is however not a hard and fast rule. If storing no value as an empty string has benefits to your code and logic then feel free to do so.

Post a Comment for "Android & Sqlite: Will A Blank Row Cause Any Database Issues?"