-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSELECT_pt1.sql
More file actions
42 lines (34 loc) · 1013 Bytes
/
SELECT_pt1.sql
File metadata and controls
42 lines (34 loc) · 1013 Bytes
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
SELECT * FROM cursos
ORDER BY nome ASC; /*DESC-> ordem Descendente; ASC-> ordem Ascendente*/
SELECT carga, ano, nome FROM cursos
ORDER BY ano; /*Filtrando colunas*/
SELECT nome, descricao, carga FROM cursos
WHERE ano='2016' /*Especificando uma Condição */
ORDER BY nome;
SELECT nome, descricao, ano FROM cursos
WHERE ano = 2017 /*Operadores Relacionais (condição)*/
ORDER BY ano, nome;
/*
----OPERADORES RELACIONAIS----
< Menor
> Maior
<= Menor igual
>= Maior igual
= Igual
!= OU <> Diferente*/
SELECT carga, nome, descricao, ano FROM cursos
WHERE carga = 40 AND ano IN(2017,2020)
ORDER BY carga;
SELECT nome, ano FROM cursos
WHERE ano BETWEEN '2014' AND '2016' /*Curso ONDE ano esta entre 2014 á 2016*/
ORDER BY ano DESC, nome asc;
SELECT nome, descricao, ano FROM cursos
WHERE ano in (2017, 2020) /*IN especificando valores a serem mostrados*/
ORDER BY ano;
SELECT nome, carga, totaulas FROM cursos
WHERE carga > 35 OR totaulas < 30;
/*
----OPERADORES LÓGICOS----
AND - Both true
OR - One true
*/