SQL Menengah untuk Kueri dengan AI
Jasmin Ludolf
Senior Data Science Content Developer


$$
*: pilih semua$$
Dua wildcard pencocokan pola:
%_
Prompt: Tampilkan judul film yang mengandung 'love'
SELECT title
FROM films
WHERE title LIKE '%love%';
|title |
|------------------------|
|Dr. Strangelove or: H...|
|Beloved |
|Cloverfield |
|The Oogieloves in the...|
...
$$
%:
%love%:Prompt: Tampilkan judul film yang mengandung 'love' dalam huruf besar atau kecil
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"Prompt: Tampilkan judul film yang berakhir dengan 'and', dalam huruf besar atau kecil
SELECT title
FROM films
WHERE LOWER(title) LIKE '%and';
|title |
|------------------------|
|Alexander's Ragtime Band|
|Wonderland |
|Finding Neverland |
...
Prompt: Tampilkan judul film yang dimulai dengan 'and', dalam huruf besar atau kecil
SELECT title
FROM films
WHERE LOWER(title) LIKE 'and%';
|title |
|------------------|
|And Then Came Love|
|Anderson's Cross |
|And So It Goes |
Prompt: Tampilkan judul film lima huruf yang dimulai dengan E
SELECT title
FROM films
WHERE title LIKE 'E____';
|title|
|-----|
|Evita|
|Earth|
Prompt: Tampilkan judul film yang tidak dimulai dengan 'The'
SELECT title
FROM films
WHERE title NOT LIKE 'The%';
|title |
|--------------------|
|Intolerance: Love...|
|Over the Hill to ...|
|Metropolis |
...


$$
$$
$$
*: memilih semua bidang_: pencocokan karakter%: posisi
LIKE: pencocokan polaNOT LIKE: mengecualikan polaILIKE: tidak sensitif huruf besar/kecilUPPER() / LOWER(): standarisasi kapitalisasiSQL Menengah untuk Kueri dengan AI