MulaiMulai sekarang secara gratis

Stuck in the middle with you

You might be fortunate, and find that the interesting parts of your strings are at either end. However, chances are, you'll want to retrieve characters from somewhere around the middle. Let's see how to use RIGHT, LEN, CHARINDEX AND SUBSTRING to extract the interior portion of a text string. The description column can contain multiple reasons for power outages in each row. We want to extract any additional causes of outage whenever Weather appears in the description column.

Latihan ini adalah bagian dari kursus

Introduction to SQL Server

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

-- Complete the query to find `Weather` within the description column
SELECT 
  description, 
  ___('___', description) 
FROM 
  grid
WHERE description LIKE '%Weather%';
Edit dan Jalankan Kode