Tp4
Question 2
Question 3
select * from film where score>=9;
Question 4
select titre,annee,score+100 as score_augmente from film ;
Question 5
select titre from film where titre like '%the%';
Question 6
select nom from acteur natural join distribution where idFilm=11 and rang=1;
Question 7
select nom from realisateur natural join film where annee<1970 and titre like '%n';
Question 8
select idActeur ,nom from acteur natural join film natural join distribution where annee=2000 and
rang=1 group by nom;
Question 9
SELECT IdFilm, Titre FROM Film ORDER BY Score DESC LIMIT 1;
Question 10
select count(*) as nombre_total from film natural join realisateur where idRealisateur=11;
Question 11
select nom ,count(idFilm) as film_realise from film natural join realisateur group by nom order by
nom ;
Question 12
select idFilm,titre,count(idActeur) as nombre_acteurs from film natural join distribution group by
idFilm;
Question 13
select idActeur,nom from acteur natural join distribution group by idActeur having count(idFilm)>5;
Question 14
select idFilm,titre from film natural join Distribution group by idFilm having count(idacteur)=1;
Question 15
SELECT A.IdActeur, A.Nom FROM Acteur A left JOIN Distribution D ON A.IdActeur = D.IdActeur
WHERE D.IdActeur IS NULL;
Question 16
SELECT A.IdActeur, A.Nom FROM Acteur A JOIN Distribution D ON A.IdActeur = D.IdActeur GROUP BY
A.IdActeur HAVING COUNT(DISTINCT D.Rang) >= 3;
Question 17
SELECT R.IdRealisateur, R.Nom FROM Realisateur R JOIN Film F ON R.IdRealisateur = F.IdRealisateur
GROUP BY R.IdRealisateur ORDER BY COUNT(F.IdFilm) DESC LIMIT 1;
Question 18
CREATE VIEW V_Film_1999 AS SELECT F.IdFilm AS film, F.Titre AS intitule, F.Annee AS date, F.Score
AS moy_votes, R.Nom AS réalisateur FROM Film F JOIN Realisateur R ON F.IdRealisateur =
R.IdRealisateur WHERE F.Annee = 1999;
Question 19
2:
select film,intitule,date from V_Film_1999;
3:
select Film from V_Film_1999 where moy_votes>=9;
4:
select intitule,date ,moy_votes+100 as moy_votes_augmente from V_Film_1999;
5:
select intitule from V_Film_1999 where intitule like '%the%';
Question 20
create view V_Film_Realisateur as select titre ,annee ,score, nom as realisateur from film f join
realisateur R on f.IdRealisateur=R.IdRealisateur ;
Question 21
insert into V_Film_1999 values(9999,'attack on titan',2025,9.5,'togachi');
Question 22
insert into V_Film_realisateur values('attack on titan',2025,9.5,'togachi');
Question 23
CREATE USER 'said'@'localhost' IDENTIFIED BY 'password';
Question 24
GRANT SELECT ON V_Film_1999 TO 'said'@'localhost';
Question 25
SHOW DATABASES;
USE TP4;
SHOW TABLES;
Question 26
insert into V_Film_1999 values(9998,'attack on titan',2025,9.5,'togachi');
Question 27
REVOKE SELECT ON V_Film_1999 from 'said'@'localhost';