SQL intermedio con IA
Jasmin Ludolf
Senior Data Science Content Developer

Instrucción: Muestra películas en inglés de menos de 90 minutos lanzadas después de 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 |
...
Instrucción: Muestra películas en inglés o francés lanzadas después de 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 |
...
Instrucción: Muestra títulos de películas y año de lanzamiento entre 1990 y 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 <= 1999Instrucción: Muestra títulos de películas y país para películas de Japón, Italia o España
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 |
...
Instrucción: Muestra títulos de películas y país para películas de Japón, Italia o España
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 |
...
Instrucción: Muestra títulos de películas y idioma excepto las que están en inglés y francés
SELECT title, language
FROM films
WHERE language NOT IN ('English', 'French')';
|title |language|
|-------------|--------|
|Metropolis |German |
|Pandora's Box|German |
|Seven Samurai|Japanese|
...
$$
AND: requiere múltiples condiciones
OR: acepta alternativas
BETWEEN: rangos
IN / NOT IN: múltiples valores
Paréntesis para agrupar condiciones y controlar la lógica

SQL intermedio con IA