Análise Exploratória de Dados em SQL
Christina Maimone
Data Scientist
Chave primária: unique, not NULL
Unique: todos os valores devem ser diferentes, exceto NULL
Not null: NULL não permitido: deve ter um valor
Check constraints: condições sobre os valores
column1 > 0columnA > columnBComum
Especial


Formato
-- With the CAST function
SELECT CAST (value AS new_type);
Exemplos
-- Cast 3.7 as an integer
SELECT CAST (3.7 AS integer);
4
-- Cast a column called total as an integer
SELECT CAST (total AS integer)
FROM prices;
Formato
-- With :: notation
SELECT value::new_type;
Exemplos
-- Cast 3.7 as an integer
SELECT 3.7::integer;
-- Cast a column called total as an integer
SELECT total::integer
FROM prices;
Análise Exploratória de Dados em SQL