Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Intro Quiz
2. Exercise 1

Instruction

Before we start, let's look at the tables we'll be working with.

We use two simple tables from an art gallery database. On the right side of the screen, there is a button named Database. Click on it to study the structure of the tables.

The artist table includes:

  • An identifier for each artist (the id column).
  • The artist's first and last name (first_name, last_name).
  • The exact dates of the artist's birth and death (birth_date, death_date).
  • The artist's nationality (nationality).

The painting table includes:

  • A unique identifier for each painting (the id column).
  • The ID of its artist (artist_id).
  • The title of the painting (title).
  • The year it was created (painted).
  • A rating for that painting, given by local experts (rating).

Now let's start the first exercise.

Exercise

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

Stuck? Here's a hint!

To filter paintings created after 1800, use a WHERE clause.

To check whether a column is NULL, use an IS NULL statement.

Want to refresh your knowledge of PostgreSQL SELECTs? Take a look at Part 2 of our Basics of PostgreSQL course.