| JOB_ID | JOB_TITLE | MIN_SALARY | MAX_SALARY |
----------------------------------------------------------------------------------------------------
| AD_PRES | | President | | 20000 | 40000 | | ||
| AD_VP | | Administration Vice President | 1 | 5000 | 30000 | | ||
| AD_ASST | | Administration Assistant | | 3000 | 6000 | | ||
| FI_MGR | | Finance Manager | | 8200 | 16000 | | ||
| FI_ACCOUNT | A | ccountant | | 4200 | 9000 | |
Permasalahan yang akan diselesaikan pada table diatas, untuk menggabungkan 2 kolom min dan max kita gunakan CONCAT
SQL >
SELECT JOB_ID, JOB_TITLE, CONCAT(CONCAT(MIN_SALARY,'--'),MAX_SALARY) AS SALARY FROM JOBS
Maka Outpunya :
----------------------------------------------------------------------------------
| JOB_ID | JOB_TITLE | SALARY |
----------------------------------------------------------------------------------
| AD_PRES | | President | | 20000--40000 | | ||
| AD_VP | | Administration Vice President | 1 | 5000--30000 | | ||
| AD_ASST | | Administration Assistant | | 3000--6000 | | ||
| FI_MGR | | Finance Manager | | 8200--16000 | | ||
| FI_ACCOUNT | A | ccountant | | 4200--9000 | |
0 comments:
Posting Komentar