In: Computer Science
2. List all the departments name , the manager’s name of each department and the location of each department.
Since your question does not have table structure I am adding
this table str and trying to resolve your question:
If you have different table str write your query according else
post that table str also.
Thanks in advance.
create table dept
(
dept_no int not null,
dept_name varchar(100) not null,
dept_location varchar(100) not null,
);
create table employee
(
SSN int not null,
emp_first_name varchar(100),
emp_last_name varchar(100),
mgr_emp_id int,
salary int;
dept_no int not null,
primary key (emp_id),
);
create table manager
(
mgr_emp_id int,
mgr_first_name varchar(100),
mgr_last_name varchar(100),
salary int;
dept_no int not null,
)
1. Retrieve the SSN and salary of the employee who work for the
headquarter department.
SELECT SSN, salary FROM employee e, dept d
where e.dept_no = d.dept_no
and dept_name = 'headquarter';
2. List all the departments name , the manager’s name of each
department and the location of each department.
select
dept.dept_name,
manager.mgr_first_name,
dept.dept_location
from dept, manager
where dept.dept_no=manager.dept_no;
3.List the last name of each employee whose salary is more than
30,000 and the last name of his/her supervisor,
--assuming here supervisior is niothing but manager
Select e.emp_last_name,m.mgr_last_name from
employee,manager
where e.mgr_emp_id = m.mgr_emp_id
and e.salary>30000 ;