Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Valor 1 no TINYINT()

Sempre no TINYINT() é utilizado valor 1? Por quê?

2 respostas
solução!

Oi Ricardo, tudo bom?

O parametro passado para Tinyint(M), segundo a documentação é:

M indicates the maximum display width for integer types. The maximum display width is 255. Display width is unrelated to the range of values a type can contain, as described in Section 11.2, “Numeric Types”. For floating-point and fixed-point types, M is the total number of digits that can be stored.

Ou seja, o parametro é referente a largura da coluna ao ser exibida. Exemplo:

| v   | a   |  b  |   c |
+-----+-----+-----+-----+
| 1   | 1   |  1  |   1 |
| 10  | 10  | 10  |  10 |
| 100 | 100 | 100 | 100 |

Aqui a usa tinyint(1), b usa tinyint(2) e c usa tinyint(3).

O valor máximo é 255 =)

Esse valor passado não interefe em nada no numero em sí.

Abraço!

Valeu!

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software