Different column names
Corresponding columns in the Projection clauses for the combined queries must have compatible data types, but the columns do not need to use the same column names.
The following query
selects the state column from the customer table and
the corresponding code column from the state table.
The query returns state code abbreviations
for customer numbers 120 through 125 and for states whose sname ends
in
a
. In compound queries, the column names or display labels in the first SELECT statement are the ones that appear in the results. Thus, in the query, the column name state from the first SELECT statement is used instead of the column name code from the second.