sql >> Database >  >> RDS >> Mysql

MYSQL schakelt automatisch bijsnijden uit

Volgens de SQL 92 documentatie, wanneer twee strings worden vergeleken, worden ze eerst even lang gemaakt door de kortste string op te vullen met spaties.

Zoek naar 8.2 <comparison predicate> in het document.

If the length in characters of X is not equal to the length
in characters of Y, then the shorter string is effectively
replaced, for the purposes of comparison, with a copy of
itself that has been extended to the length of the longer
string by concatenation on the right of one or more pad char-
acters, where the pad character is chosen based on CS. If
CS has the NO PAD attribute, then the pad character is an
implementation-dependent character different from any char-
acter in the character set of X and Y that collates less
than any string under CS. Otherwise, the pad character is a
<space>.

Dus met andere woorden. Het gaat niet om het opslaan van de waarde met het aantal spaties dat je hebt ingevoerd, maar om de vergelijking die het doet om te controleren op dubbele primaire sleutel. U kunt dus niet twee strings met een verschillend aantal spaties als primaire sleutel hebben




  1. Hoe haal ik alle rijen in mijn DB op?

  2. PHP Multiple Dropdown Box Formulier Verzenden naar MySQL

  3. PostgreSQL-databases migreren van op locatie naar de cloud met AWS RDS

  4. PostgreSQL-updates met meerdere rijen in Node.js