Me preguntaba si tomo una INT con un valor de 8, ¿quiere decir que sólo puedo van desde 1 hasta 99999999 o de 1 a 4294967295 UNSIGNED?MySQL INT significa
Respuesta
La documentación parece bastante claro:
tipo numérico Atributos
MySQL soporta una extensión para especificar opcionalmente el ancho de la pantalla de tipos de datos enteros en paréntesis a continuación de la palabra clave de base para el tipo. Por ejemplo, INT (4) especifica una INT con una pantalla de ancho de cuatro dígitos. Este ancho de la pantalla opcional puede ser utilizada por aplicaciones para mostrar valores de número entero que tiene una anchura menor que la anchura especificado para la columna por ellos izquierda-relleno con espacios. (Eso es decir, esta anchura está presente en los metadatos devueltos con conjuntos de resultados. Tanto si se utiliza o no, depende de la aplicación).
El ancho de la pantalla no limita la gama de valores que pueden ser almacenan en la columna Tampoco impide que los valores más amplios que el ancho de la columna se muestren correctamente. Por ejemplo, una columna especificado como SMALLINT (3) tiene la gama SMALLINT habitual de -32768 a 32.767, y los valores fuera de la gama permitida por tres dígitos se está representada en su totalidad en más de tres dígitos.
Tener un vistazo a la mysql documentation. Le permite conocer los detalles de todos los tipos de datos. El valor máximo es 4294967295 para firmar
Entonces, en el campo de valor de INT, tengo que configurarlo en 4294967295? – Warface
Tienes que seleccionar explícitamente otra cosa sin firmar es un entero con signo por defecto por lo que sus valores pueden ser negativos también. Y eche un vistazo a la documentación en el enlace proporcionado por Tom Squires.
Por cierto mira lo que encontré -> * http: //help.scibit.com/mascon/masconMySQL_Field_Types.html*
Type
Use for
Size
TINYINT
A very small integer
The signed range is –128 to 127. The unsigned range is 0 to 255.
SMALLINT
A small integer
The signed range is –32768 to 32767. The unsigned range is 0 to 65535
MEDIUMINT
A medium-size integer
The signed range is –8388608 to 8388607. The unsigned range is 0 to 16777215
INT or INTEGER
A normal-size integer
The signed range is –2147483648 to 2147483647. The unsigned range is 0 to 4294967295
BIGINT
A large integer
The signed range is –9223372036854775808 to 9223372036854775807. The unsigned range is 0 to 18446744073709551615
FLOAT
A small (single-precision) floating-point number. Cannot be unsigned
Ranges are –3.402823466E+38 to –1.175494351E-38, 0 and 1.175494351E-38 to 3.402823466E+38. If the number of Decimals is not set or <= 24 it is a single-precision floating point number
DOUBLE,
DOUBLE PRECISION,
REAL
A normal-size (double-precision) floating-point number. Cannot be unsigned
Ranges are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0 and 2.2250738585072014E-308 to 1.7976931348623157E+308. If the number of Decimals is not set or 25 <= Decimals <= 53 stands for a double-precision floating point number
DECIMAL,
NUMERIC
An unpacked floating-point number. Cannot be unsigned
Behaves like a CHAR column: “unpacked” means the number is stored as a string, using one character for each digit of the value. The decimal point, and, for negative numbers, the ‘-‘ sign is not counted in Length. If Decimals is 0, values will have no decimal point or fractional part. The maximum range of DECIMAL values is the same as for DOUBLE, but the actual range for a given DECIMAL column may be constrained by the choice of Length and Decimals. If Decimals is left out it’s set to 0. If Length is left out it’s set to 10. Note that in MySQL 3.22 the Length includes the sign and the decimal point
DATE
A date
The supported range is ‘1000-01-01’ to ‘9999-12-31’. MySQL displays DATE values in ‘YYYY-MM-DD’ format
DATETIME
A date and time combination
The supported range is ‘1000-01-01 00:00:00’ to ‘9999-12-31 23:59:59’. MySQL displays DATETIME values in ‘YYYY-MM-DD HH:MM:SS’ format
TIMESTAMP
A timestamp
The range is ‘1970-01-01 00:00:00’ to sometime in the year 2037. MySQL displays TIMESTAMP values in YYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD or YYMMDD format, depending on whether M is 14 (or missing), 12, 8 or 6, but allows you to assign values to TIMESTAMP columns using either strings or numbers. A TIMESTAMP column is useful for recording the date and time of an INSERT or UPDATE operation because it is automatically set to the date and time of the most recent operation if you don’t give it a value yourself
TIME
A time
The range is ‘-838:59:59’ to ‘838:59:59’. MySQL displays TIME values in ‘HH:MM:SS’ format, but allows you to assign values to TIME columns using either strings or numbers
YEAR
A year in 2- or 4- digit formats (default is 4-digit)
The allowable values are 1901 to 2155, and 0000 in the 4 year format and 1970-2069 if you use the 2 digit format (70-69). MySQL displays YEAR values in YYYY format, but allows you to assign values to YEAR columns using either strings or numbers. (The YEAR type is new in MySQL 3.22.)
CHAR
A fixed-length string that is always right-padded with spaces to the specified length when stored
The range of Length is 1 to 255 characters. Trailing spaces are removed when the value is retrieved. CHAR values are sorted and compared in case-insensitive fashion according to the default character set unless the BINARY keyword is given
VARCHAR
A variable-length string. Note: Trailing spaces are removed when the value is stored (this differs from the ANSI SQL specification)
The range of Length is 1 to 255 characters. VARCHAR values are sorted and compared in case-insensitive fashion unless the BINARY keyword is given
TINYBLOB,
TINYTEXT
A BLOB or TEXT column with a maximum length of 255 (2^8 - 1) characters
BLOB,
TEXT
A BLOB or TEXT column with a maximum length of 65535 (2^16 - 1) characters
MEDIUMBLOB,
MEDIUMTEXT
A BLOB or TEXT column with a maximum length of 16777215 (2^24 - 1) characters
LONGBLOB,
LONGTEXT
A BLOB or TEXT column with a maximum length of 4294967295 (2^32 - 1) characters
ENUM
An enumeration
A string object that can have only one value, chosen from the list of values ‘value1’, ‘value2’, ..., or NULL. An ENUM can have a maximum of 65535 distinct values.
SET
A set
A string object that can have zero or more values, each of which must be chosen from the list of values ‘value1’, ‘value2’, ... A SET can have a maximum of 64 members
A juzgar por la documentation, INT(8)
significa que se establece el ancho de pantalla a "al menos 8", pero:
El ancho de visualización no limita el rango de valores que se pueden almacenar en la columna. Tampoco impide que los valores más amplios que el ancho de la visualización de la columna se muestren correctamente.
- 1. ¿Qué significa INT (1) en MySQL?
- 2. ¿Qué significa (int (*) []) var1?
- 3. ¿Qué significa esto? (int &) a
- 4. Mysql middle int vs. int performance
- 5. MySQL: bigint Vs int
- 6. ¿Qué significa "int * a = (int [2]) {0, 2};" exactamente hacer?
- 7. MySQL 1443: ¿qué significa?
- 8. ¿Qué significa esto? int foo = foo + 4;
- 9. ¿Qué significa esto const int * & var?
- 10. ¿Qué significa int argc, char * argv []?
- 11. ¿Qué significa (int) $ _GET ['página'] en PHP?
- 12. int max = ~ 0; Qué significa eso?
- 13. Decimal VS Int en MySQL?
- 14. MySQL: Convertir INT a DATETIME
- 15. ¿Qué significa information_schema.TABLES.DATA_FREE en MySQL?
- 16. moldeada de VARCHAR a INT - MySQL
- 17. Mysql int (11) número fuera de rango
- 18. NÚMERO: Mysql que convierte Enum a Int
- 19. int en una cadena en mysql
- 20. ¿Qué significa "<=>" en MySQL?
- 21. ¿Qué significa la función de MySQL 'ELT'?
- 22. const int = int const?
- 23. Si un Int no puede ser nulo, ¿qué significa null.asInstanceOf [Int]?
- 24. ¿Qué significa la plantilla <unsigned int N>?
- 25. ¿Qué significa convertir int a void * o viceversa?
- 26. ¿Qué significa esto en c int a: 16 ;?
- 27. Explicación de int? vs int
- 28. problema joda nueva DateTime (int, int, int, int, int, int)
- 29. tipos de datos mySQL: ¿por qué hay un número después de int: int (11)
- 30. Tipo de datos MySQL INT (11) mientras que UNSIGNED INT (10)?
Este documento ([http://www.nhn.ou.edu/~baron/num_meths/Unsigned_and_Signed_Integers.pdf](http://www.nhn.ou.edu/~baron /num_meths/Unsigned_and_Signed_Integers.pdf)) debería responder todas sus preguntas. – tomthorgal