0% found this document useful (0 votes)
11 views5 pages

DB tp3

Uploaded by

lahfayoub
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

DB tp3

Uploaded by

lahfayoub
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

create view wwSalary as select

Employee_id EmpID,First_Name EmpFirstName,Last_name EmpLastName


,salary salaireemp from employees;

select * from wwSalary where salaireemp >= 3000;

create or replace view wwSalary as select


Employee_id EmpID,First_Name EmpFirstName,Last_name EmpLastName
,salary salaireemp,department_id departement from employees;
select * from wwSalary where departement = 80 and salaireemp >=1000;

create view VU_IT_PG as select * from employees where job_id like 'IT_PROG';

Update VU_IT_PG set salary=6000.50 ; commit ;

insert into Nom_Emp values


(6666,'MOHAMED','BARAK','MB@gmail', '777','17-FEB-15',
'AD_PRES','24000',NULL,NULL,'90');

delete from nom_emp where last_name like 'King';


delete from employees where employee_id=6666;

Create view Nom_Emp as select * from

EMPLOYEES where first_name like 'J%' with check option;

insert into Nom_Emp values(5555, 'MOHAMED', 'MOHAMED', 'BARAK','777', '17-SEP-15',

'AD_PRES','24000',NULL,NULL,'90');

Alors il y a une violation de la clause with check option .

insert into Nom_Emp values(5555, 'Jilali', 'MOHAMED', 'BARAK','777', '17-SEP-15',

'AD_PRES','24000',NULL,NULL,'90');

create or replace view VU_IT_PG as select * from employees where job_id like 'IT_PROG' WITH READ
ONLY;

On ne peut pas modifier cette vue car il est pour la lecture seulment.
CREATE VIEW lecseul_job_emp AS
SELECT e.first_name, e.last_name
FROM EMPLOYEES e, JOB_HISTORY jh where e.employee_id = jh.employee_id
GROUP BY e.first_name, e.last_name
HAVING COUNT(DISTINCT jh.job_id) >= 2;

CREATE SYNONYM EM FOR hr.EMPLOYEES;


CREATE SYNONYM JO FOR hr.JOBS;
CREATE SYNONYM DEP FOR hr.DEPARTMENTS;
SELECT * FROM EM WHERE Employee_id = 100;
SELECT * FROM JO WHERE job_id = 'IT_PROG';

on remarquer que les synonymes privés (EM, JO, DEP) ne sont pas accessibles dans
les autres schémas .

Séquences :

You might also like