37.1k views
3 votes
which of the following statements would create a union between all of the cities we have customers, employees, or invoices in? select city from invoice union select city from customer union select city from employee; select billing city from invoice select city from customer select city from employee; select billing city from invoice select city from customer select city from employee union; select billing city from invoice union select city from customer union select city from employee;

User Dez
by
8.2k points

1 Answer

7 votes

Final answer:

The correct statement to create a union between all the cities where we have customers, employees, or invoices is: SELECT city FROM invoice UNION SELECT city FROM customer UNION SELECT city FROM employee.

Step-by-step explanation:

The correct statement to create a union between all of the cities in which we have customers, employees, or invoices is: SELECT city FROM invoice UNION SELECT city FROM customer UNION SELECT city FROM employee;

This query combines the city column from the invoice, customer, and employee tables to create a single result set with all the cities. The keyword UNION is used to combine the results from multiple queries.

For example, if the invoice table has cities A, B, C, and the customer table has cities C, D, E, and the employee table has cities E, F, G, the result of the query would be all the distinct cities: A, B, C, D, E, F, and G.

User Farid Bekran
by
8.3k points