SQL intermedio con IA
Jasmin Ludolf
Senior Data Science Content Developer


$$
*: seleccionar todo$$
Dos comodines para coincidencia de patrones:
%_
Instrucción: Mostrar títulos de películas que contengan 'love'
SELECT title
FROM films
WHERE title LIKE '%love%';
|title |
|------------------------|
|Dr. Strangelove or: H...|
|Beloved |
|Cloverfield |
|The Oogieloves in the...|
...
$$
%:
%love%:Instrucción: Mostrar títulos de películas que contengan 'love' en cualquier caso
SELECT title
FROM films
WHERE title ILIKE '%love%';
|title |
|---------------------|
|Intolerance: Love'...|
|Love Me Tender |
|From Russia with Love|
...
SELECT title
FROM films
WHERE LOWER(title) LIKE '%love%';
$$
LOWER(title): "love actually"SELECT title
FROM films
WHERE UPPER(title) LIKE '%LOVE%';
$$
UPPER(title): "LOVE ACTUALLY"Instrucción: Mostrar títulos de películas que terminen con 'and', cualquier caso
SELECT title
FROM films
WHERE LOWER(title) LIKE '%and';
|title |
|------------------------|
|Alexander's Ragtime Band|
|Wonderland |
|Finding Neverland |
...
Instrucción: Mostrar títulos de películas que comiencen con 'and', cualquier caso
SELECT title
FROM films
WHERE LOWER(title) LIKE 'and%';
|title |
|------------------|
|And Then Came Love|
|Anderson's Cross |
|And So It Goes |
Instrucción: Mostrar títulos de películas de cinco letras que comiencen con E
SELECT title
FROM films
WHERE title LIKE 'E____';
|title|
|-----|
|Evita|
|Earth|
Instrucción: Mostrar títulos de películas que no comiencen con 'The'
SELECT title
FROM films
WHERE title NOT LIKE 'The%';
|title |
|--------------------|
|Intolerance: Love...|
|Over the Hill to ...|
|Metropolis |
...


$$
$$
$$
*: selecciona todos los campos_: coincidencia de caracteres%: posición
LIKE: coincidencia de patronesNOT LIKE: excluye patronesILIKE: insensible a mayúsculasUPPER() / LOWER(): estandarizar mayúsculasSQL intermedio con IA