SQL > SQL????? > ????

?? ??? ? ??? (left join), ? ????? (inner join) ? ??.?? ?????? ?? ????? ?? ??? ???? ??? ???? ????. ?? ? ???? ?? ???? ????? ? ??? ?? ??? ???? ???? ??? ??? ???? ??? SQL OUTER JOIN (????) ?????? ???? ???.

????? ??? ??????? ???? ?? ?????. ?? ?? Oracle ?? ??? WHERE ?? ?? ???? ? ??? ????"(+)"? ???? ???? ?? ???? ? ??????? ?????.

?? ???? ??? ?? ??? ??? ???:

Store_Information ??
Store_NameSalesTxn_Date
Los Angeles150005-Jan-1999
San Diego25007-Jan-1999
Los Angeles30008-Jan-1999
Boston70008-Jan-1999

Geography ??
Region_NameStore_Name
EastBoston
EastNew York
WestLos Angeles
WestSan Diego

?? ??? ???? ???? ???. ??? ?? ??? ????? 'New York' ??? ???? ??? ???'New York'??? Store_Information ? ???? ???? ?? ?????. ?? ?? ????? ?? ??? ? ??? ??? ???? ???:

SELECT A1.Store_Name, SUM(A2.Sales) SALES
FROM Geography A1, Store_Information A2
WHERE A1.Store_Name = A2.Store_Name (+)
GROUP BY A1.Store_Name;

??? ???Oracle? ???? ??? ???????:

??:

Store_Name SALES
Boston 700
New York
Los Angeles 1800
San Diego 250

??:??? ??? ??? ???? ?? ??SQL ? NULL?? ??? ???. ? ??? 'New York' ? Store_Information ???? ???? ?? ??? ?? "SALES" ??? NULL???.

SQL Subquery >>
?


Copyright © 2021   1keydata.com   All Rights Reserved