|
上完1Z0-051第5章:组函数和分组
上完1Z0-051第6章:表连接
进行1Z0-051第7章:子查询和关联子查询
1Z0-051共12章(上完7章),1Z0-052共19章(上完3章),1Z0-053共21章(上完0章)
总共上完全部52章中的10章
- select count(e.commission_pct) from employees e;
-
- select sum(e.commission_pct)/count(e.commission_pct)
- from employees e;
-
- select avg(e.commission_pct)
- from employees e;
-
- SELECT AVG(NVL(commission_pct, 0))
- FROM employees;
- select sum(e.commission_pct)/count(*)
- from employees e;
- ----
- SELECT department_id, manager_id, AVG(salary)
- FROM employees
- GROUP BY department_id , manager_id
- order by 1,2;
- ---
- select * from employees where employee_id=178;
- ---
- SELECT department_id , AVG(salary) a
- FROM employees
- where department_id <70
- GROUP BY department_id
- having AVG(salary) > 8000
- ;
- ---
- select department_id, job_id , avg(salary)
- from employees
- group by rollup (department_id, job_id);
-
- select department_id, job_id , avg(salary)
- from employees
- group by cube (department_id, job_id);
-
- ----
-
- select e.employee_id, d.department_name, d.department_id
- from employees e , departments d
- where e.department_id=d.department_id;
- ---
- select e.employee_id, d.department_name, department_id
- from employees e join departments d
- using ( department_id);
-
- ---
- select e.employee_id, d.department_name, e.department_id
- from employees e join departments d
- on ( e.department_id=d.department_id) ;
-
- ---
-
- select e.employee_id, d.department_name, department_id
- from employees e natural join departments d;
-
- select * from departments;
- ---
- select e.employee_id, d.department_name, d.department_id
- from employees e , departments d
- where e.department_id=d.department_id
- and e.manager_id=d.manager_id;
-
- ---
- SELECT employee_id, city, department_name
- FROM employees e
- JOIN departments d
- ON (d.department_id = e.department_id )
- JOIN locations l
- ON ( d.location_id = l.location_id)
- where l.city='Southlake';
- ---
- SELECT employee_id, city, department_name
- FROM employees e, departments d, locations l
- where d.department_id = e.department_id and
- d.location_id = l.location_id
- and l.city='Southlake';
-
- ---
-
- SELECT worker.last_name emp, manager.last_name mgr
- FROM employees worker , employees manager
- where worker.manager_id = manager.employee_id;
- ---
- SELECT e.last_name, e.salary, j.grade_level
- FROM employees e , job_grades j
- where e.salary
- BETWEEN j.lowest_sal AND j.highest_sal;
-
- ---
-
- select e.employee_id ,e.last_name ,d.department_name
- from employees e , departments d
- where e.department_id =d.department_id (+);
-
- ----
-
- select e.employee_id ,e.last_name ,d.department_name
- from employees e left outer join departments d
- on (e.department_id =d.department_id);
-
- select e.employee_id ,e.last_name ,d.department_name
- from employees e left outer join departments d
- using (department_id) ;
-
-
- select e.employee_id ,e.last_name ,d.department_name
- from departments d right outer join employees e
- on (e.department_id =d.department_id);
-
- select e.employee_id ,e.last_name ,d.department_name
- from departments d right outer join employees e
- using (department_id) ;
- ----
- select * from departments ;
- select e.employee_id ,e.last_name ,d.department_name
- from employees e , departments d
- where e.department_id (+) =d.department_id ;
-
- select e.employee_id ,e.last_name ,d.department_name
- from employees e right outer join departments d
- on (e.department_id =d.department_id);
-
- select e.employee_id ,e.last_name ,d.department_name
- from employees e right outer join departments d
- using (department_id );
-
- select e.employee_id ,e.last_name ,d.department_name
- from departments d left outer join employees e
- on (e.department_id =d.department_id);
-
- select e.employee_id ,e.last_name ,d.department_name
- from departments d left outer join employees e
- using (department_id );
-
-
-
-
-
- ---
-
- select e.employee_id ,e.last_name ,d.department_name
- from employees e , departments d
- where e.department_id (+) =d.department_id
- union
- select e.employee_id ,e.last_name ,d.department_name
- from employees e , departments d
- where e.department_id =d.department_id(+);
-
- ---
- select e.employee_id ,e.last_name ,d.department_name
- from departments d full outer join employees e
- using (department_id );
-
-
- select e.employee_id ,e.last_name ,d.department_name
- from employees e full outer join departments d
- using (department_id );
-
- ----
-
- SELECT last_name, salary
- FROM employees
- WHERE salary > any
- (SELECT salary
- FROM employees
- WHERE last_name like 'T%');
- ----
-
- select last_name from employees order by 1;
-
- SELECT last_name, job_id, salary
- FROM employees
- WHERE job_id in
- (SELECT job_id
- FROM employees
- WHERE last_name = 'Taylor')
- AND salary in
- (SELECT salary
- FROM employees
- WHERE last_name = 'Taylor');
-
-
- ---
-
- SELECT last_name, job_id, salary
- FROM employees
- WHERE (job_id , salary) in
- (SELECT job_id , salary
- FROM employees
- WHERE last_name = 'Taylor')
- ;
-
复制代码
|
|