mysql CREATE TABLE data (name VARCHAR(255));Query OK, 0 rows affected (0.09 sec)mysql CREATE TABLE chars (count INT(10));Query OK, 0 rows affected (0.07 sec)mysql INSERT INTO chars (count) VALUES (0);Query OK, 1 row affected (0.00 sec)mysql CREATE TRIGGER t1 AFTER INSERT ONdata FOR EACH ROW UPDATE chars SET count = count + CHAR_LENGTH(NEW.name);Query OK, 0 rows affected (0.01 sec)
猜你喜欢