✓ films
INSERT INTO films (titre, realisateur, annee_sortie, duree)
VALUES
('Inception', 'Christopher Nolan', 2010, 148),
('La La Land', 'Damien Chazelle', 2016, 128);
✓ seances
-- Pour cela, on suppose que les films ont été insérés et qu'on récupère leurs
IDs
-- Insertion de la séance pour Inception
INSERT INTO seances (film_id, date_seance, heure_debut, salle, prix)
SELECT id, '2025-02-15', '20:00:00', 3, 9.50
FROM films
WHERE titre = 'Inception';
-- Insertion de la séance pour La La Land
INSERT INTO seances (film_id, date_seance, heure_debut, salle, prix)
SELECT id, '2025-02-16', '18:30:00', 2, 8.50
FROM films
WHERE titre = 'La La Land';
SELECT * FROM films
WHERE annee_sortie > 2015;
✓
UPDATE seances
SET prix = 10.00
WHERE film_id = (
SELECT id FROM films WHERE titre = 'Inception'
);
DELETE FROM seances
WHERE film_id = (
SELECT id FROM films WHERE titre = 'La La Land'
);
SELECT f.titre, s.date_seance, s.prix
FROM seances s
JOIN films f ON s.film_id = f.id
ORDER BY s.date_seance;
UPDATE films
SET duree = 150
WHERE titre = 'Inception';
DELETE FROM films
WHERE titre = 'La La Land';
Document généré le 22/04/2025