SQL intermédiaire avec l’IA
Jasmin Ludolf
Senior Data Science Content Developer

Consigne : Afficher les films en anglais de moins de 90 minutes sortis après 1990
SELECT title, release_year, duration
FROM films
WHERE release_year > 1990
AND language = 'English'
AND duration < 90;
|title |release_year|duration|
|------------------------|------------|--------|
|Showdown in Little Tokyo|1991 |79 |
|Stone Cold |1991 |88 |
|Teenage Mutant Ninja ...|1991 |88 |
...
Consigne : Afficher les films en anglais ou en français sortis après 1990
SELECT title, release_year, language
FROM films
WHERE (language = 'English' OR language = 'French') AND release_year > 1990;
|title |release_year|language|
|------------------------|------------|--------|
|Beastmaster 2: Throug...|1991 |English |
|Bill & Ted's Bogus Jo...|1991 |English |
|Boyz n the Hood |1991 |English |
...
SELECT title, release_year, language
FROM films
WHERE language = 'English' OR language = 'French' AND release_year > 1990;
|title |release_year|language|
|-------------------|------------|--------|
|The Broadway Melody|1929 |English |
|Hell's Angels |1930 |English |
|A Farewell to Arms |1932 |English |
|42nd Street |1933 |English |
...
Consigne : Afficher les titres de films et l'année de sortie entre 1990 et 1999
SELECT title, release_year
FROM films
WHERE release_year BETWEEN 1990 AND 1999;
|title |release_year|
|---------------------------|------------|
|Arachnophobia |1990 |
|Back to the Future Part III|1990 |
...
release_year >= 1990 AND release_year <= 1999Consigne : Afficher les titres de films et le pays pour les films du Japon, d'Italie ou d'Espagne
SELECT title, country
FROM films
WHERE country = 'Japan' OR country = 'Italy' OR country = 'Spain';
|title |country|
|------------------------------|-------|
|Seven Samurai |Japan |
|A Fistful of Dollars |Italy |
|The Good, the Bad and the Ugly|Italy |
...
Consigne : Afficher les titres de films et le pays pour les films du Japon, d'Italie ou d'Espagne
SELECT title, country
FROM films
WHERE country IN ('Japan', 'Italy', 'Spain');
|title |country|
|------------------------------|-------|
|Seven Samurai |Japan |
|A Fistful of Dollars |Italy |
|The Good, the Bad and the Ugly|Italy |
...
Consigne : Afficher les titres de films et la langue sauf ceux en anglais et en français
SELECT title, language
FROM films
WHERE language NOT IN ('English', 'French')';
|title |language|
|-------------|--------|
|Metropolis |German |
|Pandora's Box|German |
|Seven Samurai|Japanese|
...
$$
AND : exiger plusieurs conditions
OR : accepter des alternatives
BETWEEN : plages
IN / NOT IN : plusieurs valeurs
Parenthèses pour grouper les conditions et contrôler la logique

SQL intermédiaire avec l’IA