I plan to add the same field to multiple tables. The names of these tables are stored in one table. It is too troublesome to modify one by one. I found the following way of splicing SQL statements:
select group_concat('alter table ', table_schema, '.', table_name, ' add column LINDEX INT(10);' SEPARATOR "") from information_schema.tables where table_schema='你的数据库名' and table_name like 'test%';
Modify according to personal needs,
select group_concat('alter table', table_schema,'.', table_name, 'add column side_direction varchar(20);' SEPARATOR "") from information_schema.tables where table_schema='your database name' and table_name in (SELECT table_name FROM The table that stores the table name of the field to be added);