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

Questo esercizio fa parte del corso

Introduction to SQL Server

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

-- Complete the query to find `Weather` within the description column
SELECT 
  description, 
  ___('___', description) 
FROM 
  grid
WHERE description LIKE '%Weather%';
Modifica ed esegui il codice