81.3k views
2 votes
Which of the following is a correctly formatted select statement to show the following result set with the invoice total, customer's customer id, and the invoice's billing state?

a) SELECT invoice_total, customer.customer_id, billing_state FROM invoice JOIN customer ON ...

b) SELECT total_invoice, customer.customer_id, billing_state FROM invoice INNER JOIN customer ON ...

c) SELECT invoice_total, customer.customer_id, billing_state FROM customer JOIN invoice ON ...

d) SELECT total_invoice, customer.id, state_billing FROM invoice JOIN customer ON ...

User Pcampr
by
7.6k points

1 Answer

5 votes

Final answer:

The correct SQL statement to return the result set is c) SELECT invoice_total, customer.customer_id, billing_state FROM customer JOIN invoice ON ..., where the fields should include invoice_total, customer.customer_id,

Step-by-step explanation:

The select statement that is correctly formatted to show the result set with the invoice total, customer's customer id, and the invoice's billing state is:

c) SELECT invoice_total, customer.customer_id, billing_state FROM customer JOIN invoice ON ...

This statement selects the desired fields: invoice_total, customer.customer_id, and billing_state. The tables customer and invoice are joined to combine records that have matching keys.

While the specific keys for the join condition are not provided in the option, your join condition needs to match the corresponding foreign key and primary key between the two tables, typically something like customer.customer_id = invoice.customer_id.

User Mykola Pavlov
by
8.3k points