I read an article on BBC. One of the examples they said was that people with surname 'Null' are having problems with entering their details in some websites.
No explanation is given about the error they are facing.
But as far as I know the string 'Null' and the actual Null value is completely different (from a database point of view).
Why would this cause problems in a database?
Best Answer
It doesn't cause database problems. It causes problems in applications written by developers that don't understand databases. At the root of the problem is that much database-related software displays a NULL record as the string
NULL
. When an application then relies on the string form of a NULL record (likely also using case-insensitive comparison operations), then such an application will consider any"null"
string to be NULL. Consequently a name Null would be considered to not exist by that application.The solution is to declare non-null columns as
NOT NULL
in the database, and to not apply string operations to database records. Most languages have excellent database APIs that make string-level interfaces unnecessary. They should always be preferred, also since they make other mistakes such as SQL injection less likely.