Android SQLite fts3: What should I insert: null or empty strings?

I created a SQLite FTS3 table for an Android application with multiple columns. The table is populated with user inputs. However, not all columns in a table must have a value. Example. There is a PLURAL column. The user represents a word that is a verb (not a noun), so the PLURAL column should not have a meaning.

What should I enter in the PLURAL column, the NULL value, or the empty string ""?

Except for the logic that affects the answer, is there a significant difference in database performance if I use NULL over an empty string value? Are there any known issues (like exception exceptions) if I use NULL values?

I searched on the Internet and I found some opinions on other databases, but not on SQLite fts3.

Thanks!

+5
source share
2 answers

Based on the logic: you should not insert an empty string, but NULL , since in a SQL word NULL treated as NO VALUE

There are no problems with the preliminary version related to the emptiness or invalidity of the string. The only consideration may be the case with SQL inner join . inner join only joins non- NULL fields that are appropriate for join conditions. There are special LEFT/RIGHT JOIN statements that allow you to use NULL fields in joins.

+5
source

what I understood after a few posts is that it treats zero as a combination of behavior from different database engines.

The goal is to make SQLite handle NULL the standard way. But the descriptions in SQL standards about how to handle NULL seem ambiguous. It is not clear from the standards documents how exactly NULL should be handled under any circumstances.

for more information http://www.sqlite.org/nulls.html

+1
source

Source: https://habr.com/ru/post/1201902/


All Articles