Hi all,
Been bouncing back and forth with this so thought I might ask here.
Basically, let's say I have a transactions table & model.
Each transaction can have multiple attributes. These attributes are to be stored in an attribute table.
Transaction model will have a hasMany attributes relationship.
Attributes will have a belongsTo attribute linking back to the transaction.
My issue is that these attributes can be primarily strings and doubles.
How would I go about storing these in the DB and use SQLs built in functionalities.
Eg: if I save all values as string, how do I go about utilizing the SUM, AVG,MAX functions in SQL?
Would casting be of any help here? I doubt it.
Just wanted to get your thoughts on how you would handle it.
One idea is to have either 2 separate tables (1 for strings, 1 for doubles), or 2 columns in the same table for each data type. Seems like anti-pattern.
Appreciate any guidance on this.