Oracle External combined command:The most important thing to understand (+) is that (+) is always placed on the side where information is scarce, and records on this side are displayed as null values.
Example:
First, preview the two tables that we will combine: EMPLOYEE_CHECK and EMPLOYE_CHECK_TMP.
@ _ 1 TableEMPLOYEE_CHECK:
- SQL>SELECT*FROMEMPLOYEE_CHECK;
-
- EMP_ID EMP_NAME EMP_ST_ADDR EMP_ZIP EMP_ADDR EMP_CITY EMP_PHONE EMP_SALRAY
- -------------------------------------------------------------------------------------------------------------------------------
- 100000 zou qi lei ban tian bulong street 518000 yang mei village shen zhen 123456789 3500
- 100001 cai fang jie ban tian bulong street 518000 yang mei village shen zhen 18218429577
- 100002 lu jing huan fan yu session 430060 yang mei village guang zhou 1397165903
- 100003 wu jing xin hu bei dier shifan xueyuan 430060 ming zhu yuan wu han 187 *** 235
- 100004 li wei qing shan gang du hua yuan 430060 xiao qu wu han 197 *** 436
@ _ 2 Table EMPLOYEE_CHECK_TMP:
- SQL>SELECT*FROMEMPLOYEE_CHECK_TMP;
-
- EMP_ID EMP_NAME EMP_ST_ADDR EMP_ZIP EMP_ADDR EMP_CITY EMP_PHONE EMP_SALRAY
- -------------------------------------------------------------------------------------------------------------------------------
- 100001 cai fang jie ban tian bulong street 518000 yang mei village shen zhen 18218429577
- 100003 wu jing xin hu bei dier shifan xueyuan 430060 ming zhu yuan shen zhen 187 *** 235
- 100005 ding ling han kou tai bei lu 430060 tian men dun nearby wu han 137 *** 4256 2000
Now we can combine the two tables and use '+' for combined queries:
- SQL>SELECTP. EMP_NAME, P. EMP_ADDR, P. EMP_CITY, P. EMP_PHONE,T. EMP_ZIPFROMEMPLOYEE_CHECK P, EMPLOYEE_CHECK_TMP TWHERE<Span style ="Color: # ff6600 ;"> P. EMP_ID </span> <span style ="Color: # 3366ff ;"> </Span> = <span style ="Color: # 3366ff ;"> T. EMP_ID (+ );
-
- EMP_NAME EMP_ADDR EMP_CITY EMP_PHONE EMP_ZIP
- ------------------------------------------------------------------------------
- Zou qi lei yang mei village shen zhen 123456789-- Row_1
- Cai fang jie yang mei village shen zhen 18218429577 518000
- Lu jing huan yang mei village guang zhou 1397165903-- Row_3
- Wu jing xin ming zhu yuan wu han 187 *** 235 430060
- Li wei xiao qu wu han 197 *** 436-row_5
Now, observe the two tables that are combined with the query. The primary table (P) is marked in red and the query field is:
- P. EMP_NAME, P. EMP_ADDR, P. EMP_CITY, P. EMP_PHONE
The temporary table (T) is marked in blue and the query field is:
T. EMP_ZIP
When '+' (combined with the flag) is attached to the T table, except that the where p. EMP_ID = T. in addition to EMP_ID information, the query fields corresponding to P are also returned: row_1, row_3, and row_5.