Oracle LIKE

 如果想在emp 內找job為S開頭的資料

query:

SELECT * 

FROM emp 

WHERE job LIKE 'S%'

這裡的S%代表第一個字是S開頭的

EMPNOENAMEJOBMGRHIREDATESALCOMMDEPTNO
7499ALLENSALESMAN76981981/02/20160030030
7521WARDSALESMAN76981981/02/22125050030
7654MARTINSALESMAN76981981/09/281250140030
7844TURNERSALESMAN76981981/09/081500030



如果想在emp 內找job為GER結尾的資料

query:

SELECT * 

FROM emp 

WHERE job LIKE '%GER'

EMPNOENAMEJOBMGRHIREDATESALCOMMDEPTNO
7698BLAKEMANAGER78391981/05/012850-30
7782CLARKMANAGER78391981/06/092450-10
7566JONESMANAGER78391981/04/022975-20


如果想在emp 內找job內含有S的資料

query:

SELECT * 

FROM emp 

WHERE job LIKE '%S%'

EMPNOENAMEJOBMGRHIREDATESALCOMMDEPTNO
7839KINGPRESIDENT-1981/11/175000-10
7788SCOTTANALYST75661982/12/093000-20
7902FORDANALYST75661981/12/033000-20
7499ALLENSALESMAN76981981/02/20160030030

0 Comments:

張貼留言