我嘗試學習mysql oracle數據庫,我想通過department_id顯示錶員工組的平均工資,以及平均工資類似於'%0'的情況。 這裏是我的查詢從HR表中的AVG表達式中選擇數據使用條件
select department_id, AVG(salary) as "Pay Salary per dept"
from employees
where department_id is not null and AVG(salary) like '%0'
group by department_id order by department_id
什麼是正確的查詢,以取代
AVG(salary) like '%0' ?
感謝
你使用的是MySQL還是Oracle?請適當標記問題。另外,你的問題很簡單,無效:在數字上使用「like」是沒有意義的,特別是非整數。 –
使用oracle,你能舉一些例子來回答嗎? '像''從我的情況整數 –