Q1
True / FalseIn PostgreSQL, the UNION operator returns only distinct rows from the combined result set of two or more queries.
: The UNION operator combines the result sets of two or more queries and removes duplicate rows.
Q2
True / FalseThe UNION ALL operator in PostgreSQL also removes duplicate rows from the combined result set.
UNION ALL combines the result sets of two or more queries but does not remove duplicate rows.
Q3
True / FalseIn PostgreSQL, both the UNION and UNION ALL operators require the same number of columns in their result sets.
The number and the order of columns must be the same in the queries being combined with UNION or UNION ALL.
Q4
True / False: Using UNION in PostgreSQL is faster than using UNION ALL because it removes duplicates.
UNION ALL is faster than UNION because UNION ALL does not perform the distinct operation to remove duplicates, which requires additional processing.
Q5
True / FalseIn PostgreSQL, the column names of the result set of a UNION query are taken from the first SELECT statement.
The column names of the result set of a UNION operation are determined by the first SELECT statement in the query.
Q6
True / FalseWhen using UNION in PostgreSQL, the data types of the corresponding columns in the SELECT statements must be compatible.
The data types of the columns in the SELECT statements being combined must be compatible to ensure the UNION operation works correctly.
Q7
True / FalseIn PostgreSQL, you can use the ORDER BY clause with the individual SELECT statements within a UNION query.
The ORDER BY clause can only be used at the end of the combined result set, not within the individual SELECT statements of a UNION query.
Q8
True / FalsePostgreSQL allows the use of LIMIT and OFFSET clauses in individual SELECT statements within a UNION ALL operation.
LIMIT and OFFSET can be used in individual SELECT statements to control the number of rows returned before the UNION ALL operation is applied.
Q9
True / FalseThe UNION operator in PostgreSQL guarantees the order of the result set based on the order of the input queries.
UNION does not guarantee the order of the result set. If a specific order is required, an ORDER BY clause should be used at the end of the UNION operation.
Q10
True / FalseIn PostgreSQL, a UNION ALL operation can be used to combine result sets from different schemas within the same database.
UNION ALL can combine result sets from different schemas as long as the columns are compatible and the number of columns in the SELECT statements is the same.
Q22
Multiple ChoiceIdentify the SQL queries that correctly use UNION ALL to combine results from multiple SELECT statements in PostgreSQL.
UNION ALL combines the results of multiple SELECT statements, including duplicates. The columns in each SELECT must match in number and data type.
Q23
Multiple ChoiceWhich SQL queries correctly apply UNION and UNION ALL to combine and filter data from multiple tables in PostgreSQL?
UNION removes duplicates while UNION ALL includes all rows. Properly structuring these queries ensures correct data retrieval based on the requirements.
Q24
Multiple ChoiceDetermine the SQL queries that correctly use UNION and UNION ALL with different SELECT statements in PostgreSQL.
Correct use of UNION and UNION ALL allows for effective merging of data sets, either with or without duplicates, based on the requirement.
Q25
Multiple ChoiceIdentify the SQL queries that correctly use UNION and UNION ALL to merge data from 'projects' and 'completed_projects' tables in PostgreSQL.
UNION and UNION ALL are effective for merging similar data sets while controlling for duplicates based on the data requirements.
Q26
Multiple ChoiceWhich SQL queries correctly use UNION and UNION ALL with filters in PostgreSQL?
Correct filtering combined with UNION and UNION ALL ensures that the merged data set meets the specific requirements, with or without duplicates.
Q27
Multiple ChoiceIdentify the SQL queries that correctly use UNION and UNION ALL to merge results from multiple SELECT statements in PostgreSQL.
Combining data from multiple tables using UNION and UNION ALL requires attention to the structure of SELECT statements and the handling of duplicates.
Q29
Multiple ChoiceWhich SQL queries correctly apply UNION ALL to include all rows from combined SELECT statements in PostgreSQL?
UNION ALL includes all rows from the combined result set, including duplicates, which is essential when complete data is needed.