SELECT nom, ville
FROM Clients;
SELECT *
FROM Clients;
SELECT ALL ville
FROM Clients;
SELECT DISTINCT ville
FROM Clients;
##Selection (clause WHERE)
SELECT *
FROM Clients
WHERE ville = 'Aytré';
SELECT *
FROM Films
WHERE prix >= 4.90;
SELECT *
FROM Locations
WHERE date >= 2020-11-01
SELECT *
FROM Clients
WHERE nom in ('Dupond', 'Dupont');
SELECT *
FROM Films
WHERE titre LIKE 'Finding%';
SELECT *
FROM Clients
WHERE nom LIKE 'D%d';
SELECT *
FROM Clients
WHERE telephone = '';
SELECT *
FROM Films
ORDER BY titre ASC;
SELECT *
FROM Films
ORDER BY prix DESC;
SELECT COUNT(*)
FROM Films;
SELECT DISTINCT(prix)
FROM Films;
SELECT prix,COUNT(*)
FROM Films
GROUP BY prix;
SELECT num_film, num_client
FROM Locations
SELECT Locations.id_loc, Films.titre
FROM Films, Locations
WHERE Locations.num_film = Films.num;
SELECT Locations.id_loc, Films.titre, Clients.nom
FROM Films, Locations, Clients
WHERE Locations.num_film = Films.num
AND Locations.num_client = Clients.num;
SELECT Clients.nom, COUNT(*)
FROM Films, Locations, Clients
WHERE Locations.num_film = Films.num
AND Locations.num_client = Clients.num
GROUP BY Clients.nom;
SELECT Films.titre, COUNT(*)
FROM Films, Locations, Clients
WHERE Locations.num_film = Films.num
AND Locations.num_client = Clients.num
GROUP BY Films.titre;
SELECT Films.titre, COUNT(*)
FROM Films, Locations, Clients
WHERE Locations.num_film = Films.num
AND Locations.num_client = Clients.num
GROUP BY Films.titre
ORDER BY COUNT(*) DESC
LIMIT 1;
SELECT Clients.nom, AVG(Films.prix)
FROM Films, Locations, Clients
WHERE Locations.num_film = Films.num
AND Locations.num_client = Clients.num
GROUP BY Clients.nom;