Home |  MySQL Buzz |  FAQ |  Feeds |  Submit your blog feed |  Feedback |  Archive |  Aggregate feed RSS 2.0 English Deutsch Español Français Italiano 日本語 Русский Português 中文
Showing entries 1 to 2

Displaying posts with tag: numeric (reset)

Know your data – and your numeric types.
+0 Vote Up -0Vote Down
Numeric types in MySQL have two varieties: - “precise” types such as INTEGER and DECIMAL; - the IEEE-standard floating point types FLOAT and DOUBLE. As a rule of thumb, the first group are for exact, “counted” quantities. The INTEGER types represent whole numbers, and DECIMAL represents “fixed point” decimal, with a preset number of places after the decimal point. Various widths of INTEGER are available in MySQL, from 8-bit TINYINT to 64-bit BIGINT. Calculations with integer types are fast, as they usually correspond to hardware register sizes. DECIMAL is commonly used for quantities like decimal currency where the number of digits of precision is known and fixed. For example, exactly counting pennies in two decimal digits. Computation with DECIMAL is slower than other types, but this is unlikely to impact most applications. In the other category are FLOAT and DOUBLE,  [Read more...]
MySQL INT(1) or INT(10)
+0 Vote Up -0Vote Down

In short, it really doesn’t matter.  After watching a MySQL web conference by Jay Pipes, I was gutted when I found out that they are actually exactly the same.  I know im not alone in thinking that it affected the size of the data field.  An unsigned int has the max value of 4294967295 no matter if its INT(1) or int(10) and will use 4 bytes of data.

So, what does the number in the brackets mean?  It pretty much comes down to display, its called the display-width.  The display width is a number from 1 to 255. You can set the display width if you want all of your integer values to “appear”.  If you enable zerofill on the row, the field will have a default value of 0 for int(1) and 0000000000 for int(10).

There are 5 main numeric

  [Read more...]
Showing entries 1 to 2

Planet MySQL © 1995, 2014, Oracle Corporation and/or its affiliates   Legal Policies | Your Privacy Rights | Terms of Use

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.