Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #81

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions Resolvido/SQL_Resolvido.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
--Desafio 1 concluído
SELECT Nome, Ano FROM Filmes;

--Desafio 2 concluído
SELECT Nome, Ano, Duracao FROM Filmes
ORDER BY Ano ASC;

--Desafio 3 concluído
SELECT Nome, Ano, Duracao FROM Filmes
WHERE Id = 28;

-- Desafio 4 conclúido
SELECT Nome, Ano, Duracao FROM Filmes
WHERE Ano = 1997
ORDER BY Duracao ASC;


-- Desafio 5 concluído
SELECT Nome, Ano, Duracao FROM Filmes
WHERE Ano > 2000
ORDER BY Duracao DESC;

-- Desafio 6 concluído
SELECT Nome, Ano, Duracao FROM Filmes
WHERE Duracao > 100 AND Duracao < 150
ORDER BY Duracao ASC;

-- desafio 7 -----
SELECT
Ano,
COUNT(*) AS Quantidade
FROM Filmes
GROUP BY Ano
ORDER BY Count(*) DESC;

-- Desafio 8
SELECT
PrimeiroNome,
UltimoNome,
Genero
FROM Atores
WHERE Genero = 'M';

-- Desafio 9
SELECT
PrimeiroNome,
UltimoNome,
Genero
From Atores
WHERE Genero = 'F'
ORDER BY PrimeiroNome ASC;

-- Desafio 10
SELECT F.Nome AS Filme, G.Genero AS Genero
FROM FilmesGenero FG
INNER JOIN Filmes F ON FG.IdFilme = F.Id
INNER JOIN Generos G ON FG.IdGenero = G.Id;

-- Desafio 11
SELECT
F.Nome AS Filme,
G.Genero AS Genero
FROM FilmesGenero FG
INNER JOIN Filmes F ON FG.IdFilme = F.Id
INNER JOIN Generos G ON FG.IdGenero = G.Id
WHERE Genero = 'Mistério';

-- Desafio 12
SELECT
F.Nome AS Filmes,
A.PrimeiroNome AS PrimeiroNome,
A.UltimoNome AS UltimoNome,
EF.Papel AS Papel
FROM ElencoFilme EF
INNER JOIN Atores A ON EF.Id = A.Id
INNER JOIN Filmes F ON EF.Id = F.Id;