Mysql
 SQL >> Datenbank >  >> RDS >> Mysql

Was bringt ZEROFILL in MySQL?

ZEROFILL füllt angezeigte numerische Werte mit führenden Nullen bis zur Spaltenanzeigebreite auf. Es impliziert außerdem UNSIGNED.

CREATE TABLE yourtable (
  x INT(8) ZEROFILL NOT NULL,
  y INT(8) NOT NULL
);
INSERT INTO yourtable (x, y) VALUES (1, 1), (12, 12), (123, 123);

Der gespeicherte Wert bleibt unverändert; nur die Anzeige ändert sich.