-
Notifications
You must be signed in to change notification settings - Fork 0
/
popg_dql.sql
75 lines (60 loc) · 1.63 KB
/
popg_dql.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
SELECT * FROM Funcionario WHERE (salario_funcionario >300);
Select *
From Cliente, Planos
WHERE fk_Planos_id_plano =
id_plano;
Select *
From Cliente LEFT OUTER JOIN Planos
ON fk_Planos_id_plano =
id_plano;
Select *
From Cliente RIGHT OUTER JOIN Planos
ON fk_Planos_id_plano =
id_plano;
Select *
From Cliente LEFT OUTER JOIN Planos
ON fk_Planos_id_plano = id_plano
UNION
Select *
From Cliente RIGHT OUTER JOIN Planos
ON fk_Planos_id_plano =
id_plano;
Select *
From Eventos INNER JOIN Filial_Gerente fg
ON fk_Filial_Gerente_id_filial = id_filial
GROUP BY nome_evento ;
Select *
From Eventos INNER JOIN Filial_Gerente fg
ON fk_Filial_Gerente_id_filial = id_filial
GROUP BY nome_evento
HAVING (data_evento > '2004-01-01');
Select *
From Eventos INNER JOIN Filial_Gerente fg
ON fk_Filial_Gerente_id_filial = id_filial
ORDER BY data_evento;
Select *
From Eventos INNER JOIN Filial_Gerente fg
ON fk_Filial_Gerente_id_filial = id_filial
WHERE CEIL(salario)>700;
Select *
From Eventos INNER JOIN Filial_Gerente fg
ON fk_Filial_Gerente_id_filial = id_filial
ORDER BY LENGTH(nome_evento);
Select *
From Cliente c INNER JOIN Avaliacao a
ON CPF = fk_Cliente_CPF
WHERE EXTRACT(YEAR FROM data_avalaicao)-(EXTRACT(YEAR FROM Data_incio )>1);
Select *
From Cliente c INNER JOIN Planos p
WHERE nome_plano = 'bronze'
UNION
Select *
From Cliente c INNER JOIN Planos p
WHERE nome_plano = 'prata';
Select *
From Filial_Gerente INNER JOIN aloca a
WHERE id_filial = fk_Filial_Gerente_id_filial AND CPF =fk_Filial_Gerente_CPF
INTERSECTION
Select *
From Equipamentos e INNER JOIN aloca a
WHERE id_equipamento = fk_Equipamentos_id_equipamento;