IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Introduction to SQL Server

Visualizza il corso

Istruzioni dell'esercizio

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

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

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;
Modifica ed esegui il codice