Before we can begin we need to decide what fields we wish to include in our address book. For this demonstration we will use Name, E-mail and Phone number, although you can modify it to included more options if you like.
To create this database we need to execute this code:
CREATE TABLE address (id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(30), phone VARCHAR(30), email VARCHAR(30)); INSERT INTO address (name, phone, email) VALUES ( "Alexa", "430-555-2252", "firstname.lastname@example.org"), ( "Devie", "658-555-5985", "email@example.com" )
This creates our database fields, and puts in a couple of temporary entries for us to work with. We are creating four fields. The first is a self incrementing number, then name, phone and email. We will use the number as a unique ID for each entry when editing or deleting.