Menyaring teks

SQL Menengah untuk Kueri dengan AI

Jasmin Ludolf

Senior Data Science Content Developer

Pencocokan pola

Satu buku

SQL Menengah untuk Kueri dengan AI

Pencocokan pola

Koleksi buku

SQL Menengah untuk Kueri dengan AI

Wildcards

$$

  • *: pilih semua

$$

Dua wildcard pencocokan pola:

  • %
  • _

Wildcards

SQL Menengah untuk Kueri dengan AI

Mencocokkan teks dengan %

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...|
...

$$

%:

  • Mencocokkan karakter apapun
  • Sensitif huruf besar/kecil
  • %love%:
    • Apapun sebelum atau sesudah "love"
    • Tepat "love" dalam huruf kecil
SQL Menengah untuk Kueri dengan AI

Sensitivitas huruf besar/kecil

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|
...
SQL Menengah untuk Kueri dengan AI

Sensitivitas huruf besar/kecil

SELECT title 
FROM films
WHERE LOWER(title) LIKE '%love%';

$$

  • Judul asli: "Love Actually"
  • LOWER(title): "love actually"
    • Cocok dengan "love"
SELECT title 
FROM films
WHERE UPPER(title) LIKE '%LOVE%';

$$

  • Judul asli: "Love Actually"
  • UPPER(title): "LOVE ACTUALLY"
    • Cocok dengan "LOVE"
SQL Menengah untuk Kueri dengan AI

Mencocokkan teks dengan %

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    |
SQL Menengah untuk Kueri dengan AI

Mencocokkan teks dengan _

Prompt: Tampilkan judul film lima huruf yang dimulai dengan E

SELECT title
FROM films
WHERE title LIKE 'E____';
|title|
|-----|
|Evita|
|Earth|
  • "Elf" atau "Enchanted" tidak cocok
SQL Menengah untuk Kueri dengan AI

Mengecualikan nilai teks

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          |
...
SQL Menengah untuk Kueri dengan AI

Pencocokan pola

  • Temukan kesamaan dalam teks

Email pemasaran

SQL Menengah untuk Kueri dengan AI

Pencocokan pola

  • Temukan kesamaan dalam teks

Keuangan dan produk

SQL Menengah untuk Kueri dengan AI

Pencocokan pola

  • Temukan kesamaan dalam teks

$$

$$

$$

  • Sensitif huruf besar/kecil
  • Wildcards
    • *: memilih semua bidang
    • _: pencocokan karakter
    • %: posisi

AI dengan kaca pembesar

  • LIKE: pencocokan pola
  • NOT LIKE: mengecualikan pola
  • ILIKE: tidak sensitif huruf besar/kecil
  • UPPER() / LOWER(): standarisasi kapitalisasi
SQL Menengah untuk Kueri dengan AI

Ayo berlatih!

SQL Menengah untuk Kueri dengan AI

Preparing Video For Download...