SQL intermédiaire avec l’IA
Jasmin Ludolf
Senior Data Science Content Developer


$$
*: sélectionner tout$$
Deux jokers pour la correspondance de motifs :
%_
Invite : Afficher les titres de films contenant 'love'
SELECT title
FROM films
WHERE title LIKE '%love%';
|title |
|------------------------|
|Dr. Strangelove or: H...|
|Beloved |
|Cloverfield |
|The Oogieloves in the...|
...
$$
% :
%love% :Invite : Afficher les titres de films contenant 'love' sans distinction de casse
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"Invite : Afficher les titres de films se terminant par 'and', sans distinction de casse
SELECT title
FROM films
WHERE LOWER(title) LIKE '%and';
|title |
|------------------------|
|Alexander's Ragtime Band|
|Wonderland |
|Finding Neverland |
...
Invite : Afficher les titres de films commençant par 'and', sans distinction de casse
SELECT title
FROM films
WHERE LOWER(title) LIKE 'and%';
|title |
|------------------|
|And Then Came Love|
|Anderson's Cross |
|And So It Goes |
Invite : Afficher les titres de films de cinq lettres commençant par E
SELECT title
FROM films
WHERE title LIKE 'E____';
|title|
|-----|
|Evita|
|Earth|
Invite : Afficher les titres de films ne commençant pas par 'The'
SELECT title
FROM films
WHERE title NOT LIKE 'The%';
|title |
|--------------------|
|Intolerance: Love...|
|Over the Hill to ...|
|Metropolis |
...


$$
$$
$$
*: sélectionne tous les champs_: correspondance de caractères%: position
LIKE: correspondance de motifsNOT LIKE: exclut les motifsILIKE: insensible à la casseUPPER() / LOWER(): standardiser la casseSQL intermédiaire avec l’IA