Database Reference
In-Depth Information
phone number. Next, change someone's email address and his or her relationship
to you (i.e.,
relation_id
). Do this in one
UPDATE
statement.
5. Run a
SELECT
statement that joins both tables created in the first exercise. Use
the
JOIN
clause to do this (the
JOIN
clause was covered in this chapter, so look
back at the example if you don't remember how to use it). Join the tables on the
common column named
relation_id
— this will go in the
WHERE
clause. To
help you with this, here's how the clauses for the tables should look:
...
FROM
contacts
JOIN
relation_types
WHERE
contacts
.
relation_id
=
relation_types
.
relation_id
...
Select the columns
name
and
phone_mobile
, but only for contacts who are
marked as a
Friend
— you'll have to add this to the
WHERE
with
AND
. Try do-
ing this based on the value of
relation_id
and then again based on the value
of the
relationship
column.