Complete the code to select all unique names from two tables using UNION.
SELECT name FROM employees UNION SELECT [1] FROM managers;The UNION operation requires the columns to match by position and type. Here, both SELECT statements must select the 'name' column.
Complete the code to combine salaries from two tables using UNION ALL.
SELECT salary FROM full_time UNION ALL SELECT [1] FROM part_time;UNION ALL combines all rows including duplicates. Both SELECT statements must select the 'salary' column to match.
Fix the error in the set operation by choosing the correct column to match.
SELECT id, name FROM customers INTERSECT SELECT [1], name FROM orders;Both SELECT statements must have the same number of columns and compatible types in the same order. Here, 'id' matches the first column.
Fill both blanks to correctly combine product names and prices from two tables using UNION.
SELECT [1], [2] FROM products_a UNION SELECT product_name, price FROM products_b;
The first SELECT must select columns that match the second SELECT by position and type. 'name' matches 'product_name' in type, and 'price' matches 'price'.
Fill all three blanks to correctly perform a UNION of employee details with matching columns.
SELECT [1], [2], [3] FROM staff UNION SELECT emp_name, emp_salary, emp_dept FROM employees;
Each column in the first SELECT must match the corresponding column in the second SELECT by position and type. Here, 'name' matches 'emp_name', 'salary' matches 'emp_salary', and 'department' matches 'emp_dept'.