Which two are true about a SQL statement using SET operators such as UNION? (Choose two.)
Which two are true about a SQL statement using SET operators such as UNION? (Choose two.)
When using SQL statements with SET operators such as UNION, the data type group of each column returned by the second query must match the data type group of the corresponding column returned by the first query. This means that a column in one SELECT statement can be unioned with a column in another SELECT statement if they belong to the same data type group, such as numeric or character. Additionally, the number of columns in all SELECT statements must be identical, although the names of the columns do not need to match.
A B are the correct options
i agree
reference https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/The-UNION-ALL-INTERSECT-MINUS-Operators.html#GUID-B64FE747-586E-4513-945F-80CB197125EE
I would also say A and B - "...Tables must have the same number of columns presented in the same order. In addition, the data type of the corresponding column must be in the same data type group such as number or character..."
A and B are correct. For SET operator, Data type group should be matched. For example, a NUMBER column in first query can be UNIONed with INTERGER column in second query.
I was confused with C and A since A. mentions "data type group". i can confirm that a CHAR can be matched with VARCHAR2. ans is A B
A and B are correct
In queries using set operators, Oracle does not perform implicit conversion across data type groups. Therefore, if the corresponding expressions of component queries resolve to both character data and numeric data, Oracle returns an error. https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/The-UNION-ALL-INTERSECT-MINUS-Operators.html#GUID-B64FE747-586E-4513-945F-80CB197125EE
why not E?
SELECT 1 FROM DUAL UNION SELECT '0' FROM DUAL; --ORA-01790: expression must be of same datatype as corresponding expression
I think B, C
sorry the answer is AB. because The select list are identical in the number of expressions in the list and their respective data type groups.
AB correct
A , B is correct.
A,B is correct
C & E is correct answer