cinema

Download Cinema

If you can't read please download the document

Upload: imad-hakkache

Post on 21-Nov-2015

3 views

Category:

Documents


2 download

DESCRIPTION

tp

TRANSCRIPT

create table film(idfilm integer primary key,titre varchar(14),nom varchar(14),annee integer);create table acteur(idacteur integer primary key,nom varchar(14),prenom varchar(14)); create table filmographie(idacteur integer primary key,idfilm integer,role varchar(14),salaire float(7,2));/*****pour modifier les 2 cl******/ALTER TABLE `filmographie` DROP PRIMARY KEY, ADD PRIMARY KEY( `idacteur`, `idfilm`);/*****changement de varchar a text*************/ALTER TABLE `film` CHANGE `titre` `titre` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL;///****ajouter filmINSERT INTO film VALUES (1,'Les evads','Drabon',1994),(2,'Le parrain','Coppola',1972),(3,'Le parrain','Coppola',1972),(4,'Lodysse de Pi','Ang Lee',2013);/*****afichage des filmsSELECT * from film///question 4 ajout des films suivants INSERT INTO film VALUES (5,'Chocolat','Hallstrom',2000),(6,'Scarface','De Palma',1983),(7,'Rango','Verbinski',2011);/***question 5 affichage des titre et cle des filmsSELECT idFilm,titre FROM film/*****Insertion de acteurInsert INTO acteur VALUES(1,'Johnny','Deep'),(2,'Al','Pacino'),(3,'Suraj','Sharma'),(4,'Brad','Pitt'),(5,'Edwar','Norton');/*******************************11---FilmographieInsert INTO filmographie VALUES(1,5,'Roux',5000),(1,7,'Rango',10000),(2,2,'Michael Corleone',10000),(2,3,'Michael Corleone',20000),(2,6,'Tony Montana',15000),/***voir le nombre des film jou par JohhhnySelect idfilm from filmographie where idacteur=1(3,4,'Pi',20000);Select titre from film,acteur,filmographie where filmographie.idacteur=/*****Select idacteur from acteur where nom='Johnny'/******affichage de titre jou par johnnySelect titre from film,filmographiewherefilm.idfilm=filmographie.idfilmand idacteur=(Select idacteur from acteur where nom='johnny');/*****realisateurSELECT titre from film where realisateur=(SELECT realisateur from film where titre='Le parrain')/*******tt qui commence par deSELECT titre from filmwhere titre like'Le%';/*******de ou le SELECT titre from filmwhere titre like'Le%'or titre like 'de%';/*******SELECT titre from filmorder by annee desc/***********************nombre acteurSELECT count(idacteur) from filmographie whereidfilm=(Select idfilm from film where titre='Lodysse de Pi');