Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The value of NULL in MySQL

 
Reehan Lalkhanwar
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What is the actual value of NULL stored in the database by MySQL?
The database has to have some way to identify that the field value is NULL, so what value it uses to represent a NULL?
 
Christian Dillinger
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you interested in it? As a developer you don't have to think about it. If you aren't a developer and interested in MySQL go to mysql.
 
Reehan Lalkhanwar
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I want to store non-english language in DB as bit values that my application can understand, I need to know if I have some constraints on if there are some ASCII values I have to avoid.
Moreover I thought it would not hurt to know.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's stored as an internal value. Nothing you can store in a nullable column will make it think it's null/not null.
 
Victor Dolirio
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Null does mean an unknown value. If you try to operate something like: 1 + (unknown), the result is surelly unkown. Likewise true && NULL is also NULL. Don't misundertood it with 0(zero) neither with false because these values values are different.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a database questions, not an ORM question.

Each database may implement this in any way they choose, so long as they follow the appropriate SQL specification.
However, it will be via some attribute of the column value, not through the value itself. If a column value is null, it has no value. If you supply a value (any value) for a column, it is no longer null. Don't think of null as a value, think of it more like a state.

Hope this helps,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic