SQL intermedio con IA
Jasmin Ludolf
Senior Data Science Content Developer
SELECT title, release_year
FROM films
ORDER BY release_year DESC, title ASC;
|title |release_year|
|----------------|------------|
|10,000 B.C. | |
|A Touch of Frost| |
|Anger Management| |
|Animal Kingdom | |
...
SELECT COUNT(*) AS total_count
FROM films;
|total_count|
|-----------|
|4968 |
SELECT COUNT(language) AS language_count
FROM films;
|total_count|
|-----------|
|4957 |
$$
$$
✅ Identificar, seleccionar, excluir valores faltantes
❌ Arreglar o reemplazar valores faltantes

Causas:
$$
Valores faltantes:
NULL: valor realmente faltante" " o "None"
Instrucción: Muestra títulos de películas e idiomas sin idioma
SELECT title, language
FROM films
WHERE language IS NULL;
|title |language|
|--------------------|--------|
|Intolerance: Love...| |
|Over the Hill to ...| |
|The Big Parade | |
...
Instrucción: Muestra títulos de películas e idiomas que tienen un idioma definido
SELECT title, language
FROM films
WHERE language IS NOT NULL;
|title |language|
|-------------------|--------|
|Metropolis |German |
|Pandora's Box |German |
|The Broadway Melody|English |
|Quest for Fire |None |
...

$$
IS NULL y IS NOT NULL solo detectan valores realmente faltantes$$
NULL realmente faltantesInstrucción: Muestra títulos de películas e idiomas donde el idioma es 'None'
SELECT title, language
FROM films
WHERE language = 'None';
|title |language|
|-------------------|--------|
|Quest for Fire |None |
|Samsara |None |
Instrucción: Muestra todos los valores de idioma únicos
SELECT DISTINCT language
FROM films;
|language|
|--------|
| |
|Arabic |
...
|None |
...
Instrucción: Muestra títulos de películas e idiomas donde el idioma no es nulo ni None
SELECT title, language
FROM films
WHERE language IS NOT NULL AND language != 'None';
|title |language|
|-------------------|--------|
|Metropolis |German |
|Pandora's Box |German |
|The Broadway Melody|English |
...
$$
$$

$$
NULL pero incluyen ceroCOUNT(*) incluye todas las filas, incluso NULL
SQL intermedio con IA