Merging two tables into one with the same column names
问题 I use this command to merge 2 tables into one: CREATE TABLE table1 AS SELECT name, sum(cnt) FROM (SELECT * FROM table2 UNION ALL SELECT * FROM table3) X GROUP BY name ORDER BY 1; table2 and table3 are tables with columns named name and cnt , but the result table ( table1 ) has the columns name and sum . The question is how to change the command so that the result table will have the columns name and cnt ? 回答1: In the absence of an explicit name, the output of a function inherits the basic