The CUSTOMERS and SALES tables contain these columns:
CUSTOMERS
CUST_ID NUMBER(10) PRIMARY KEY
COMPANY VARCHAR2(30)
LOCATION VARCHAR2(20)
SALES
SALES_ID NUMBER(5) PRIMARY KEY
CUST_ID NUMBER(10) FOREIGN KEY
TOTAL_SALES NUMBER(30)
Which SELECT statement will return the customer ID, the company and the total sales?

Respuesta :

Answer:

Using join on both table against column CUST_ID will return customer ID, company and total sales

Explanation:

select

CUSTOMERS.CUST_ID,

CUSTOMERS.COMPANY,

SALES.TOTAL_SALES

from CUSTOMERS JOIN SALES

ON

CUSTOMERS.CUST_ID=SALES.CUST_ID

Above query selects required customer id and company table from customers table and total sales from sales table and apply join against customer id

JOIN in sql returns all the row where for a value in first table there is a matching value in second table.

ACCESS MORE