* inner JOIN (left join)
SELECT A1.region_name REGION, SUM(A2.Sales) SALES
FROM Geography A1, Store_Information A2
WHERE A1.store_name = A2.store_name
GROUP BY A1.region_name
REGION | SALES |
East | $700 |
West | $2050 |
* outer JOIN (right join)
SELECT A1.store_name, SUM(A2.Sales) SALES
FROM Georgraphy A1, Store_Information A2
WHERE A1.store_name = A2.store_name (+)
GROUP BY A1.store_name
store_name | SALES |
Boston | $700 |
New York | |
Los Angeles | $1800 |
San Diego | $250 |
沒有留言 :
張貼留言