Question

In my first question on this forum, I learned that MySQL treats NULL and an empty string differently. As an Oracle database-centric developer, I can accept this and even see a potential use for it. But I don't see how this works in an actual application with a front-end app.

Let's say you have a php app for entering contact information. If (in the database), the person's middle name is NULL, that means we don't know if the person has a middle name.

If it is an empty string, we know the person has no middle name.

But on the web page form, can you make this distinction? I don't see how. I can't see using (and have never seen) a checkbox or option for the user to tell the app that a text field is unknown vs. empty (none).

So please enlighten me and tell me how making a distinction in the database adds value to the big picture.

Thanks.

No correct solution

OTHER TIPS

In the example you gave, no, I don't think there'd be a way to communicate to the user that the field is NULL or to allow the user to specify NULL as opposed to simply blank/empty.

Since the concept of null would be an unnecessary hardship for the end user to understand, I think generally you'd try to phrase questions and prompts to put it in terms they understand and on the backend decide how that information needs to be stored and processed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top