Re: How to represent variable data types?



On Jan 3, 5:57 pm, bukzor <workithar...@xxxxxxxxx> wrote:
In my application we have a data structure that comes in four flavors:
double, integer, string, and timestamp. To store it in our database,
so far we've used four separate tables (values_d, values_i, ...). This
works OK, but means that we need to do every query four times if we
don't know the data type we're looking for (the usual case).

I'm working on refactoring the database this week, and notice that my
double, string, and timestamp tables have very few unique values,
meaning that I could save disk space (and possibly query time) if I
normalize the data out of those tables. Once that's done, all my
values_* tables have the exact same signature, making me wonder if
they couldn't be consolidated into one table.

Any suggestions?

Has anyone solved this problem before?
--Buck

Sounds to me like you are mapping some programming construct (like a C
union{} ) onto the database.At first glance this seems a bad idea.
Ed
.



Relevant Pages

  • Re: runtime error with Mask edit control
    ... DateOfBirth property is a string. ... If no value is entered into the Property, the database stores a null. ... > its data type (one would assume the same as the property, ...
    (microsoft.public.vb.controls)
  • Re: [PhP - dB] About Formatting a Date Result
    ... In the MySQL database the field is set to date not timestamp as you ... foresight has stored a string date instead of a timestamp, ... and can format your date to that used, in the config files, for any user ...
    (php.general)
  • How to represent variable data types?
    ... double, integer, string, and timestamp. ... I'm working on refactoring the database this week, ... meaning that I could save disk space (and possibly query time) if I ...
    (comp.databases)
  • Re: How to represent variable data types?
    ... double, integer, string, and timestamp. ... I'm working on refactoring the database this week, ... meaning that I could save disk space (and possibly query time) if I ...
    (comp.databases)
  • Re: Database datatype to c# datatype
    ... GetFieldTypeand GetValueon any IDataReader. ... because I get metadata about a database column: ... One of the items of data describing the column is a string value which gives ... the data type of the column. ...
    (microsoft.public.dotnet.languages.csharp)