SQL present
SQl
Sql Presentation
SQl presentation
1.select first_name, last_name from employees where salary>=10000;
2.select first_name, last_name, department_name from employees ,departments
where employees.department_id = departments.department_id;
3.select first_name, last_name, department_name, job_title
from employees,departments, jobs where employees.department_id=departments.department_id
and employees.job_id = jobs.job_id;
4 select department_id,count(*) from employees group by department_id;
5select job_id, count (*) from employees group by job_id;
6select job_title , count(*) from employees, jobs
where employees.job_id = jobs.job_id group by job_title;
nsert into student
(student_id, student_name, email)
values
(105, 'anu', 'andu4u@yahoo.com');
select * from student;
commit;
select * from student;
update student set student_name = 'anu'
where student_id = 105;\
select * from student order by student_id;
select * from student;
alter table student add unique index (email);
select email, count(*) from student
group by email;
update student
set email='mgavr@hotamil.com1' where student_id = 100;
commit;
select * from student order by student_id;
commit;
select * from student;
create view employee_full_info as
select first_name, last_name, department_name, job_title
from employees e, departments d, jobs j where e.department_id = d.department_id
and e.job_id = j.job_id;
select rowid,e.* from employees e;
select * from employee_full_info;
select department_name,
count(*) from employee_full_info
group by department_name;
delete from student where student_id = 105;
select * from student;
commit;
select first_name, last_name,email from employees;
select job_id,job_title from jobs;
select e.first_name,e.last_name,e.email,j.job_title
from employees e ,jobs j where e.job_id=j.job_id;
select d.department_name,l.city ,c.country_name,r.region_name
from departments d,locations l ,countries c,regions r
where l.location_id=d.location_id
and l.country_id=c.country_id
and c.region_id=r.region_id;
select e1.first_name|| ' ' ||e1.last_name as employee_name,
e2.first_name|| ' ' ||e2.last_name as manager_name,
nvl(e2.email,'N/A') as manager_email
from employees e1, employees e2
where e1.manager_id=e2.employee_id(+);
select * from employees where salary <5000
or salary>10000;
select * from employees where salary < 5000
union all
select *from employees where salary > 10000;
select * from employees where salary >10000
minus
select *from employees where salary > 12000;
select e.first_name,e.last_name ,d.department_id ,l.city from
employees e, locations l,departments d
where e.department_id=d.department_id
and d.location_id=l.location_id
and l.city='Seattle';
select first_name,last_name from employees where department_id in
(select department_id from departments where location_id in
(select location_id from locations where city='Seattle'))
No comments:
Post a Comment