Aan de slagGa gratis aan de slag

Using parentheses in your queries

You can use parentheses to make the intention of your code clearer. This becomes very important when using AND and OR clauses, to ensure your queries return the exact subsets you need.

Deze oefening maakt deel uit van de cursus

Introduction to SQL Server

Cursus bekijken

Oefeninstructies

Select all artists beginning with B who released tracks in 1986, but also retrieve any records where the release_year is greater than 1990.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

SELECT 
  artist, 
  release_year, 
  song 
FROM 
  songlist 
  -- Choose the correct artist and specify the release year
WHERE 
  (
    artist LIKE 'B%' 
    ___ release_year = ___
  ) 
  -- Or return all songs released after 1990
  ___ release_year ___ ___ 
  -- Order the results
ORDER BY 
  release_year, 
  artist, 
  song;
Code bewerken en uitvoeren