BUT2/BD/TP_BD_06.04.2023.txt

90 lines
2.6 KiB
Plaintext
Executable File

connection: wamster iut ora2 nomal
Q1)----------------------------------------------------------------------------------------------------------------
CREATE USER wamster_prop1 identified by iut default tablespace datausers4F temporary tablespace temp;
CREATE USER wamster_prop2 identified by iut default tablespace datausers4F temporary tablespace temp;
grant connect, resource to wamster_prop1, wamster_prop2
Q2)a)----------------------------------------------------------------------------------------------------------------
create table Client(
login varchar2(20) primary key,
nomClient varchar2(30),
prenomClient varchar2(30)
);
create table Film(
numFilm integer primary key,
nomFilm varchar2(30)
);
create table Location(
login varchar2(20) references Client,
numFilm integer references Film,
dateLocation Date,
primary key(login,numFilm)
);
b)
insert into Client
values ('WAMSTER_PROP1', 'Wamster', 'Willy');
insert into Client
values ('WAMSTER_PROP2', 'Wamster', 'Marty');
insert into Client
values ('WAMSTER', 'Wamster', 'Alexis');
insert into Film
values (0, 'Harry Poter');
insert into Film
values (1, 'L''armée des 12 singes');
insert into Film
values (2, 'Avenger: infinity war');
insert into Location
values('WAMSTER_PROP1',2,'13-12-2002');
insert into Location
values('WAMSTER_PROP1',1,'12-12-2012');
insert into Location
values('WAMSTER_PROP2',2,'12-01-2008');
insert into Location
values('WAMSTER_PROP2',1,'20-02-2002');
insert into Location
values('WAMSTER',0,'28-05-2004');
insert into Location
values('WAMSTER',1,'11-11-2011');
c)
create view Mes_Locations
as select nomClient, numFilm, dateLocation
From Client natural join Location
where login=user;
grant select on Mes_Locations to public;
Q3)----------------------------------------------------------------------------------------------------------------
select * from Client; => table inexistante
select * from wamster_prop1.Client;
Q4)a)----------------------------------------------------------------------------------------------------------------
grant select on Mes_Locations to wamster_prop2;
grant select,insert,update on Location to wamster_prop2;
create view VClient
as select nomClient, prenomClient
from Client;
grant insert,update on VClient to wamster_prop2;
grant insert on Film to wamster_prop2;
b)
select * from wamster_prop1.Mes_Locations;
c)
insert into wamster_prop1.Film
values (3,'Les aventures de Jordan');
insert into wamster_prop1.Client
values ('koumbisamba','Cyril','Koumbisamba');
delete from wamster_prop1.Client
where login='koumbisamba';
delete from wamster_prop1.Film
where numFilm=3;