Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Introduction to SQL Server

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

-- Complete the query to find `Weather` within the description column
SELECT 
  description, 
  ___('___', description) 
FROM 
  grid
WHERE description LIKE '%Weather%';
Code bewerken en uitvoeren