Advanced Database Lab Project Final
Advanced Database Lab Project Final
LAB PROJECT
Group Member
1. CHERNET ALEMU RCS/1320/12
2. DEBORAH GETSCHEW RCS/1956/12
3. KIDIST MARKOS RCS/2010/12
1) To display the REGION_NAME and COUNTRY_NAME using NATURAL JOIN
ANS
SELECT E.LAST_NAME, J.JOB_TITLE FROM EMPLOYEES E LEFT OUTER JOIN JOBS ON (E.JOB_ID = E.JOB_ID);
3) To display JOB_TITLE and LAST_NAME using FULL OUTER JOIN
ANS
SELECT E.LAST_NAME, J.JOB_TITLE FROM EMPLOYEES E FULL OUTER JOIN JOBS J ON (E.JOB_ID = E.JOB_ID);
6) To display LAST-NAME and SALARY of employees whose salary is >= the average
salary of all employees[use multiple row subqueries
ANS
SELECT last_name, salary FROM employees WHERE salary < ALL (SELECT salary FROM employees WHERE
job_id = '>=') ;
7) To display the DEPARTMENT-ID, minimum and maximum salary of each department
employees.
ANS
Select DEPARTMENT_ID max (salary) as MaxSalary, min(Salary) as Minsalary from EMPLOYEES group by
DEPARTMENT_ID
8) To define SAVEPOINT [you can give it any name] over the department table. Make
the save point appear after a DELETE statement of a record deletion and before one
UPDATE and one INSERT statement. Then write a Rollback statement to your
defined savepoint.
ANS
SELECT * FROM hr.employees;
Delete from hr.DEPARTMENTS where DEPARTMENT_ID='400';
SAVEPOINT Ydelete;
SELECT * FROM hr.DEPARTMENTS;
SAVEPOINT YInsert;
9) To create a role and a user [you can give it any name you want]
ANS
11) To give update privilege on the salary field of employee table for the user
created with permission propagation privilege
ANS
GRANT UPDATE ON HR.EMPLOYEES TO H1s_proj WITH GRANT OPTION;
GRANT UPDATE(Salary) ON HR.EMPLOYEES TO H1s_proj