Mediumint refers to the fact that it is three bytes long rather than a
regular 4 byte, 32 bit integer.  It's range is like +/- 8,000,000 or so
(look it up for sure)

The 6 just has to do with how many digits will be displayed when you invoke
the MySQL client for the row - spacing will be a minimum of 6 characters
wide.

>From the website:
http://www.mysql.com/doc/en/Numeric_types.html
"As an extension to the ANSI/ISO SQL92 standard, MySQL also supports the
integer types TINYINT, MEDIUMINT, and BIGINT as listed in the tables above.
Another extension is supported by MySQL for optionally specifying the
display width of an integer value in parentheses following the base keyword
for the type (for example, INT(4)). This optional width specification is
used to left-pad the display of values whose width is less than the width
specified for the column, but does not constrain the range of values that
can be stored in the column, nor the number of digits that will be displayed
for values whose width exceeds that specified for the column. When used in
conjunction with the optional extension attribute ZEROFILL, the default
padding of spaces is replaced with zeroes. For example, for a column
declared as INT(5) ZEROFILL, a value of 4 is retrieved as 00004. Note that
if you store larger values than the display width in an integer column, you
may experience problems when MySQL generates temporary tables for some
complicated joins, as in these cases MySQL trusts that the data did fit into
the original column width. "

So, MEDIUMINT(6) can contain +/-8,000,000 (more or less) and will display as
6 characters wide.

Don't feel bad, I had the same confusion on char and varchar fields and what
they can store/display.

Have Fun,

Ken Hylton
Programmer Analyst IV
LEC Systems & Programming

Billing Concepts, Inc.
7411 John Smith Drive
San Antonio, Texas 78229-4898
(210) 949-7261



-----Original Message-----
From: Paul DuBois [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 4:53 PM
To: Jan Kudrman; [EMAIL PROTECTED]
Subject: Re: mediumint(6) problem


At 23:05 +0200 9/11/02, Jan Kudrman wrote:
>Hi all,
>
>I have a small problem - I have the following table with numetic type. In
my
>table is mediumint(6), but I can to insert value 11223344. I thougth the
>maximum value for mediumint(6) is 999999.

Why?

>
>Do you have some idea what I should to do to be able insert value 999999 as
>a maximum for my field?
>
>My table:
>CREATE TABLE `table` (
>   `id_a` mediumint(6) unsigned NOT NULL default '0',
>   `id_b` mediumint(6) unsigned NOT NULL default '0',
>   `id_c` mediumint(6) unsigned NOT NULL default '0',
>   `area` char(2) NOT NULL default '',
>   `group` tinyint(3) unsigned NOT NULL default '0',
>   PRIMARY KEY  (`id_a`,`id_a`,`id_b`)
>) TYPE=MyISAM
>
>Background:
>MySQL version 3.23.49 on Red Hat Linux 7.3.
>
>Thank tou very much for your help.
>
>Regards,
>Jan


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to