Introductory quiz
2. Exercise 1

Instruction

First, let's get to know our data. We'll use two simple tables with information from an art museum. On the right side of this screen, there is a button named Database. Click it to study the structure of the tables.

The Artist table includes:

  • internal identifiers for each artist (the Id column),
  • each artist's first and last name (FirstName and LastName),
  • artists' birth and death dates (BirthDate and DeathDate),
  • each artist's nationality (Nationality).

The Painting table includes:

  • internal IDs for each painting (the Id column),
  • artist IDs (ArtistId),
  • painting titles (Title),
  • year of creation (Painted),
  • an expert rating of the painting (Rating).

Are you ready for the first exercise?

Exercise

For each painting created in or after 1800, show its title and the year in which it was painted (the Painted column). Include paintings for which the creation date is unknown.

Stuck? Here's a hint!

Use a WHERE clause to filter paintings created after 1800. To check whether a column is NULL, you'll need an IS NULL statement.

If you want to refresh your knowledge of SQL Basics in SQL Server, look at our SQL Basics in SQL Server course. You'll find relevant help in Part 2: Selecting from one table.