MySql Database Table

Now that you have set up the structure of your MySql database table, it's time to add a few records.

With phpMyAdmin still open, click the Insert tab at the top, three to the right of the Structures tab you're on now. You should see a screen like this one:

The Insert tab in phpMyAdmin

All the columns we set up are there, on the left. To add a new row, just type something into the Value text boxes. For the first record, add the following:

First_Name: David
Family_Name: Khan
Job_Title: Programmer
Photo: 1.png

Your Insert tab should look like this:

Some new values for the database table

Notice that the ID Value is left blank. MySql will take care of adding an auto increment number for us. The photo file name is just 1.png. You'll be downloading some photos for this project soon and you'll see they are all numbered 1, 2, 3, etc. If you want to use your own photos, you type the file name here, replacing 1.png with whatever your photo is called.

Click the GO button at the bottom to add a new row to your table. A new screen appears. This one:

The SQL tab of phpMyAdmin

The green area at the top is telling you that 1 row has been inserted. The area at the bottom is the SQL query for what you have just done. It's this:

INSERT INTO `tbl_employees` (`ID`, `First_Name`, `Family_Name`, `Job_Title`, `Photo`) VALUES (NULL, 'David', 'Khan', 'Programmer', '1.png');

If you want, rather than going back to the Insert tab and entering a second record, you can do it here. Just change the values to something else. So where we have David, Khan, Programmer, 1.png. You could change these to something else. Click the INSERT button below and you'll have a second record. Or if you've made a spelling mistake, you could correct it here and click UPDATE. When we do our database programming later, we'll be constructing a SQL query like the one above.

However, click back on the Insert tab as it's easier to insert new record from there. Add the following record:

First_Name: Mike
Family_Name: Singh
Job_Title: Systems Analyst
Photo: 2.png

Click Go to add it to your table.

Come back to insert and add a third record:

First_Name: Davina
Family_Name: Hope
Job_Title: Programmer
Photo: 3.png

Add a fourth record:

First_Name: Anaya
Family_Name: Hanson
Job_Title: IT Manager
Photo: 4.png

To see all four of your new records, click on the Browse tab at the top:

The Browse tab in phpMyAdmin showing four records added to the database table

And that's it! We now have a database we can use in our Python code.

In the next lesson, we'll design the form that's going to be used for data entry.

Design a Data Entry Form >