April 2017
Beginner to intermediate
360 pages
9h 35m
English
Let's add a fifth user to our application, eve. We'll sign her up with a full complement of profile fields:
INSERT INTO "users" ("username", "email", "encrypted_password", "location") VALUES ('eve', 'eve@gmail.com', 0x85e36ed9f726295921a4a6f40d95c202c895180c, 'Washington, D.C.');
On checking the users table, we can confirm that eve has the data we intended:

Now let's imagine that another user, also named eve, would like to use MyStatus. If we naively allow her to choose any username she wants, we will end up attempting to create her username like this:
INSERT INTO "users" ("username", "email", "encrypted_password") ...Read now
Unlock full access