List:General Discussion« Previous MessageNext Message »
From:Steve Edberg Date:December 13 2001 6:01am
Subject:Re: Inches and Degrees
View as plain text  
Well, as far as the inches and fractions thereof go, you could always 
normalize your data to the smallest measurement - for example: if the 
smallest increment is 1/32 of an inch, store all measurements in terms of 
32nds. So, 1" => 32, 1-5/32" => 37, and so on. Then you could store the 
values in an integer column. Or, use a NUMERIC column (stored as strings, 
so there is no roundoff error as there is with floating-point numbers)  and 
convert to metric: 1-5/32" = 29.36875mm exactly. Convert measurements 
to/from english as needed for input or display. If you will be dealing with 
metric measurements in the near future, that might be a more reasonable way 
to go.

Lastly, if you covert to metric and want to use a floating point column, read

         http://www.mysql.com/doc/P/r/Problems_with_float.html

first.

If I were me, and the site wasn't dealing in many metric tools, I'd 
probably use the first method.


At 07:43 PM 12/12/01 , Jonathan Duncan wrote:
>I am creating a database for a website that sells tools.  Unfortunately they
>aren't measured in metric.  Most of the measurements look something like:
>
>1 1/16"
>3/8"
>3/16"
>1 5/32"
>45º
>10º
>2 7/16"
>
>These aren't pretty numbers to enter into a database.  The simple way would
>be to enter them as CHAR's and forget about them, but then searching on that
>could cause problems.
>
>Does anyone have any idea what would be the best way to enter these number
>and as what type?
>
>Thanks in advance,
>Jonathan Duncan


+------------------------------------------------------------------------+
| Steve Edberg                                      sbedberg@stripped |
| Database/Programming/SysAdmin                            (530)754-9127 |
| University of California, Davis             http://pgfsun.ucdavis.edu/ |
+---------------------- Gort, Klaatu barada nikto! ----------------------+

Thread
Inches and DegreesJonathan Duncan13 Dec
  • Re: Inches and DegreesSteve Edberg13 Dec
    • Re: Inches and DegreesJonathan Duncan13 Dec
  • Re: Inches and DegreesKeith C. Ivey13 Dec