How do you handle “special case” data when modeling a database?

Our organization provides various services to our clients (for example, web hosting, technical support, user programming, etc.). Our site has a page listing all the available services and their corresponding prices. It was static data, but my boss wants them all pulled out of the database.

The list lists about 100 services. However, only two of them have a non-numerical value for the “price” (in particular, the lines “ISA” and “cost + 8%” - I really do not know what they should mean, so don’t need to ask me).

I would really like the price column to be varchar just because of these two lists. My current approach is to create a special field called "price_display", which is either empty or contains text to display instead of price. This solution is too much like a dirty hack (this would unnecessarily complicate requests), so is there a better solution?

+5
source share
8 answers

Please note that this column is the price displayed to the customer , which may contain anything.

You will invite sorrow if you try to make it a numeric column. You are already struggling with two inappropriate values, and tomorrow your boss may want more ...

  • !
  • !!

.

, internalPrice - , .

+4

, :

Price   Unit   Display
10.00   item   null
100.00  box    null
null    null   "Call for Pricing"

( , ), .

case , . , , . , .

, , , , , . , , , ( , ).

+4

...

? ? ?

-?

, (varchar).

+2

, "type" , , , . , . , .

+1

:

  • varchars
  • price_display, , .
  • , price_display , ( )
  • , ( yuk!!)
  • varchar price, ( " +",...), , ( '$', '%', 'description'). , .

2 5, .

+1

, varchar . - , -, , . $10/GB " " $25 " "?

, . .

, , , , , - ( ) . .

+1

, , , , , Price, ? "", 8 "PercentOverCost" null "ISA" ( Price PriceType).

, PriceType PriceTypeID, .

( , foriegn currancy), , , .

+1

All Articles