Database Reference
In-Depth Information
Looking at the current state of the
users
table, we can see that the
email
and
en-
crypted_password
columns from the original
eve
's account have been overwritten
by the new
eve
. However, the
location
column is untouched—it still shows
Wash-
ington, D.C.
, the value from the first
eve
's account.
This is because we did not specify a
location
column in the second
INSERT
state-
ment. The
INSERT
statements only touch columns that are listed in the parenthesized list
of columns that directly follows the table name. So, we can think of our most recent query
as saying, "set the
email
and
encrypted_password
columns in the row with key
eve
to the specified values."
Clearly, we've got a problem. The row at key,
eve
, now contains a mishmash of informa-
tion from two different user profiles, and we've lost data from the first
eve
's profile. How
can we prevent this from happening?