4 messages in com.mysql.lists.gui-toolsRe: Column Type Confusion| From | Sent On | Attachments |
|---|---|---|
| Jim McAtee | 04 Jul 2003 11:39 | |
| Adam Hooper | 04 Jul 2003 11:45 | |
| Jim McAtee | 04 Jul 2003 12:49 | |
| Jim McAtee | 08 Jul 2003 17:26 |
| Subject: | Re: Column Type Confusion![]() |
|---|---|
| From: | Adam Hooper (ada...@densi.com) |
| Date: | 07/04/2003 11:45:30 AM |
| List: | com.mysql.lists.gui-tools |
This is a MySQL issue and not a MySQLCC issue. This caught me quite off-guard too, believe me: The tinyint(4) means that a maximum of 4 *characters* will be used to display the column in decimal notation. "-127", for example, takes 4 characters. Notice that "int" is 11 characters, and "unsigned int" is 10: this is because the negative sign is not needed on unsigned int.
I'm not sure (no time to check, I'm at work!) but I think that the data is stored the same way regardless of the length; if not, then the data is truncated on insertion.
The actual data storage length is fixed; a tinyint indeed is 8 bits, and an int is 32.
In short, don't touch the 'length' option: it'll only break things.
Adam Hooper ada...@densi.com
Jim McAtee wrote:
I'm fairly new to MySQL and MySQL CC. My question regards what I'm seeing and creating in MySQL CC, mostly in regard to the various integer data types.
In the SQL docs, for instance, it says that a tinyint is 8 bits (-127 to 128, or 0 to 255 unsigned). When I create a tinyint in MySQLCC, the display shows tinyint(4). I assume this is bits, not bytes, but I'm not certain. I would expect it to either display (1) byte or (8) bits.
Similarly, for an int it show int(11). If bytes, that would seem extremely large, but it's smaller than the 16 bits shown in the documentation.
I'm also a bit confused about being able to change the length in MySQL CC. I would have thought that each type was fixed in size. If the above lengths are just default lengths (in bits) and if the lengths are highly flexible in MySQL, then the values chosen seem odd. I would expect more common default lengths that align on byte boundaries.
Any clarification would be apprectiated, Jim




