SQL Intermediário com IA
Jasmin Ludolf
Senior Data Science Content Developer

Prompt: Mostrar filmes em inglês com menos de 90 minutos lançados apó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 |
...
Prompt: Mostrar filmes em inglês ou francês lançados apó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 |
...
Prompt: Mostrar títulos de filmes e ano de lançamento entre 1990 e 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 <= 1999Prompt: Mostrar títulos de filmes e país para filmes do Japão, Itália ou Espanha
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 |
...
Prompt: Mostrar títulos de filmes e país para filmes do Japão, Itália ou Espanha
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 |
...
Prompt: Mostrar títulos de filmes e idioma, exceto em inglês e 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: requer múltiplas condições
OR: aceita alternativas
BETWEEN: intervalos
IN / NOT IN: múltiplos valores
Parênteses para agrupar condições e controlar a lógica

SQL Intermediário com IA