Skip to content
Advertisement

Best way to represent NULL in a column that represents a type [closed]

Given a table with a column that represents a type A or B or None, how should the None be represented? As a NULL or explicitly None or something else?

Advertisement

Answer

In general, I would advocate in favor of using NULL to represent the absence of data. Rationale:

  • null will never conflict with other values – so if one you eventually comes up with a actual value of 'None', this is not a problem

  • null works across datatypes, so it can be used consistently across different tables or columns to represent “missing” data (which saves you the burden of choosing, then remembering the value you picked for each and every column)

5 People found this is helpful
Advertisement