In Oracle SQL, when using the set operators like MINUS, the number of columns and their data types in the SELECT statements must match in sequence.
A. This query will not execute successfully because the SELECT * FROM bricks_stage will return all columns from the BRICKS_STAGE table, which are WEIGHT, SHAPE, and COLOR, but the first SELECT statement specifies only SHAPE and COLOR. The order and number of columns must match.
B. This query will not execute successfully. The SELECT statements have a different number of columns, and the data types of the columns in the same positions do not match between the two queries. The first column in the first SELECT is SHAPE (VARCHAR2), and in the second SELECT, it is WEIGHT (NUMBER).
C. This query will execute successfully. The SELECT * from both tables will ensure that the number of columns and their data types are the same, as SELECT * selects all columns from the table. As long as the two tables have the same column order and data types for those columns, the query will execute.
D. This query will not execute successfully. Even though the columns are of the same data types, their order in the SELECT statements must match for the set operator to work. The order of SHAPE and COLOR is switched between the two queries.
E. This query will not execute successfully. The number of columns in the SELECT statements is the same, but their data types do not match between the two queries. BRICK_ID (NUMBER) in the first query does not match WEIGHT (NUMBER) in the second, and SHAPE (VARCHAR2) does not match COLOR (VARCHAR2).
References:
Oracle Database SQL Language Reference, 12c Release 1 (12.1): "Combining Queries with Set Operators"
Oracle Database SQL Language Reference, 12c Release 1 (12.1): "MINUS"