oracle 查詢測試樣題

來源:互聯網
上載者:User

標籤:


1.select count(*) from employees where last_name like '_A%';key:02.select count(*)from employeeswhere to_char(hire_date,'YYYY')=1998;select count(*)from employeeswhere hire_date like '%98';key:23select to_char(hire_date,'YYYY') from employees;3.select job_title, max_salary-min_salary as "SAL_DIEF"from jobsorder by max_salary-min_salary desc;select job_title,(max_salary-min_salary) as "SAL_DIEF"from jobsorder by 2 desc;19行記錄4.select count(*)from employeeswhere (salary>12000 or salary<1000)and job_id !='ST_MAN' and job_id!='SH_CLERK' ;number:6================select count(*)from employeeswhere salary not between 1000 and 12000and job_id not in('ST_MAN','SH_CLERK') ;select salaryfrom employeeswhere salary<1000 and salary>12000;--當它判斷1000為假時就不判斷後面的大於12000了.select job_id from employees;select * from employeeswhere job_id in('ST_MAN','SH_CLERK');--工作崗位名稱要加單引號5.select count(*)from employeeswhere to_char(hire_date,'YYYY')=1999and to_char(hire_date,'mm')=02;key:3select count(*)from employeeswhere to_char(hire_date,'YYYY-MM')='1999-02';6.select last_name,salary,decode(trunc(salary/1500),0,'A',   1,'B',                   2,'C',     'D') Gradefrom employeeswhere last_name like'%s';7.select d.department_id,d.department_name,l.cityfrom departments d,locations lwhere d.department_id in(10,40,90)and d.location_id=l.location_id;8.select l.city,c.country_name,r.region_namefrom locations l,regions r,countries cwhere l.location_id=1000 and l.country_id=c.country_idand c.region_id=r.region_id;9.select  m.last_name "MAN_NAME",nvl(e.last_name,'NO EMPLOYEES') "EMP_NAME"from employees m,employees ewhere m.department_id=100and m.employee_id=e.manager_id(+);10行記錄select  m.last_name MAN_NAME,nvl(e.last_name,'NO EMPLOYEES') EMP_NAMEfrom employees m,employees ewhere m.department_id=100and m.employee_id=e.manager_id(+);10select department_id,count(*) NUMfrom employeeswhere salary>8000group by department_id;9行記錄11select department_id,count(*) NUMfrom employeeswhere salary>5000group by department_idhaving count(*)>3;3行記錄12select last_name,salaryfrom employeeswhere salary>(select salary from employees where employee_id=110)and department_id=100;2行記錄13select count(*) NUMfrom employeeswhere commission_pct<all(select distinct commission_pct from employees where salary>12000and commission_pct is not null);24行記錄


oracle 查詢測試樣題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.