In languages such as Java, for example, when processing an int short and comparing with another short int, both are transformed into int. Does the same thing occur in a database like MySQL?
In languages such as Java, for example, when processing an int short and comparing with another short int, both are transformed into int. Does the same thing occur in a database like MySQL?
The two types mentioned are integers, what changes is how much each type supports.
smallint: (2 bytes) -32768 to +32767 (with sign) / 0 to 65535 (unsigned)
int: (4 bytes) -2147483648 to +2147483647 (with sign) / 0 to 4294967295 (unsigned)
To know which type to use as a PK, you should look at how much information you will have.