set sql_mode='strict_all_tables'; create schema if not exists test; create table test.x (id int); create table test.y (id int, col1 varchar(10)); create table test.z (col1 varchar(10)); insert into test.x values (1); insert into test.y values (1, 'a'); insert into test.z select 'test' as col1 from test.x inner join test.y on (y.id = 1) group by col1; insert into test.z values ('123'); select * from test.z;