Creating a MySQL Database
Page One: But First, a Database -->
Page Two: Data Types-->
Page Three: Using phpMyAdmin to create the
simple database-->
Page Four: Defining our Database Fields-->
Page Five: Inserting some Data into our Table-->
Defining Our Database Fields
Now here is that thing of beauty. Your page will look like this image.
Here is a summary of the data we will enter.
| Field | Type | Length | Attributes | Null | Extras | Radio |
|---|---|---|---|---|---|---|
| petID | INT | 11 | not | auto_ increment |
primary | |
| species | VARCHAR | 100 | not | |||
| breed | VARCHAR | 100 | not | |||
| name | VARCHAR | 100 | not | |||
| age | TINYINT | 2 | UNSIGNED | null | ||
| enterDate | DATETIME | not | ||||
| personality | TEXT | not | ||||
| petPic | VARCHAR | 100 | not |
Remember that an unsigned number is only positive. Know any negative number ages for pets? Also note that we allow the age field to be null in case the age of the animal cannot be determined. The first field, the ID, will be the primary key that identifies each animal. We will allow MySQL to auto increment, or automatically assign this ID each time we make a new entry.
If you want, you can add a description in the "Table Comments" field. Set the "Table Type" to MyISAM. Now click the "Save" button and let phpMyAdmin do all of the work. The next screen (in window) you see displays the raw SQL statement you would have had to type, and below that, a list of your fields and attributes in a more readable format. You’ll notice also that you can select the checkbox for each field and drop (delete) it or change it. Next-->