sql >> Databasteknik >  >> RDS >> Mysql

MYSQL inaktivera Auto-trim

Enligt SQL 92 dokumentation, när två strängar jämförs görs de först lika långa genom att fylla ut den kortaste strängen med mellanslag.

Sök efter 8.2 i dokumentet.

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>.

Så med andra ord. Det handlar inte om att lagra värdet med antalet mellanslag du angett, utan det är jämförelsen det gör för att kontrollera om det finns dubbletter av primärnyckeln. Så du kan inte ha två strängar med olika antal mellanslag som fungerar som en primärnyckel




  1. Krävs nyckelordet "som" i Oracle för att definiera ett alias?

  2. Syntaxfel på grund av att ett reserverat ord används som tabell- eller kolumnnamn i MySQL

  3. En datamodell för att hålla reda på dina mest värdefulla ägodelar

  4. Kryptera MySQL-trafik i skript