Sunday, 15 September 2013

Mixed data types in one column (int and decimal): separate or get together?

Mixed data types in one column (int and decimal): separate or get together?

In my Rails app (with PostgreSQL) I'm importing some metrics from Google
Analytics:
Visitors - int
Goal 1 Completions - int
Goal 2 Completions - int
Goal N Completions - int
Transactions Amount - int
Transactions Revenue - decimal
Here's the table with data, if all of them were int:
id - int
date - date
metric_id - int
metric_amount - int
But Transactions Revenue is decimal, so I have 2 options.
Option 1. Make all of them decimal
id - int
date - date
metric_id - int
metric_amount - decimal
Option 2. Create additional nullable column for Revenue
id - int
date - date
metric_id - int
metric_amount - int
metric_revenue - decimal
Which one is better?

No comments:

Post a Comment