Soldato
- Joined
- 22 Nov 2007
- Posts
- 4,209
Hi guys
Following an sql course and i am onto joins. I can understand them now but i have a query about this code.
I am selecting from 2 tables but i only have to type "FROM SALES" and not the product table. I know i have called the SALESPERSON name so whats the point of the "FROM" bit if it already knows whats been called?
Hope that makes sense.
SELECT ORDER_ID, S.CUSTOMER_ID, SALESPERSON.FIRST_NAME FROM
SALES S INNER JOIN CUSTOMER C
ON S.CUSTOMER_ID = C.CUSTOMER_ID
LEFT OUTER JOIN SALESPERSON
ON S.SALESPERSON_ID=SALESPERSON.SALESPERSON_ID;
Following an sql course and i am onto joins. I can understand them now but i have a query about this code.
I am selecting from 2 tables but i only have to type "FROM SALES" and not the product table. I know i have called the SALESPERSON name so whats the point of the "FROM" bit if it already knows whats been called?
Hope that makes sense.
SELECT ORDER_ID, S.CUSTOMER_ID, SALESPERSON.FIRST_NAME FROM
SALES S INNER JOIN CUSTOMER C
ON S.CUSTOMER_ID = C.CUSTOMER_ID
LEFT OUTER JOIN SALESPERSON
ON S.SALESPERSON_ID=SALESPERSON.SALESPERSON_ID;