Solutions
Exercice 1 :
Solution :
CREATE VIEW clientsRecents AS
SELECT * FROM clients WHERE date_inscription > '2023-01-01';
Interroger la vue :
SELECT * FROM clientsRecents;
Exercice 2 :
Solution :
CREATE VIEW infosClientsCommandes AS
SELECT c.nom, c.email, cmd.montant_total, cmd.date_commande
FROM clients c
JOIN commandes cmd ON c.id_client = cmd.id_client;
Interroger la vue :
SELECT * FROM infosClientsCommandes;
Exercice 3 :
Solution :
CREATE VIEW produitsSimples AS
SELECT id_produit, nom, prix FROM produits;
UPDATE produitsSimples SET prix = 99.99 WHERE id_produit = 10;
Last updated