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

Instruction

Wow, excellent! You remembered that very good!

Now, let's see if you can still recall how to work with more than one table.

In this task, our small database collects information about pets and their owners in two separate tables.

pet (id, owner_id, name, type, year_born)

Each pet has an id, is assigned to a specific owner (via owner_id), has a name, is of certain type (dog, cat, ...), and was born in a specific year (the year_born column).

owner (id, name, year_born)

Each owner has an id, a name, and, again, was born in a specific year (the year_born column).

Exercise

Show all pets (show the columns name, type, year_born) whose name begins with an 'M' together with their owners (the columns name, year_born).

Rename the column year_born from the table pet as pet_year_born and the column year_born from the table owner as owner_year_born.

Stuck? Here's a hint!

Use the following template to help you build your query:

SELECT ...
FROM ...
JOIN ...
  ON ...
WHERE ...;