Part III: Entering data into the database

You can manually enter data into the database using the MySQL query method or using the GUI method. That being said, programmers often use a PHP script to write data to MySQL databases, and similarly, use PHP scripts to extract data from MySQL databases. This tutorial will not go into the PHP side, as it is beyond the scope of this tutorial.

Method 1: SQL query window

Let’s enter in some of the following data records manually using the MySQL query method.

Table of Sample Data

To insert the first record, we would type in the following command at the MySQL query window. Make sure that you have the correct database selected before you try to issue this command!


INSERT INTO employees
(name, email, social)
values
("Peter", "peter@blinkdagger.com", "111-11-1111")

Notice that we did not specify a value for emp_id because MySQL automatically takes care of that.

Similarly, we can keep on inserting as many records as we please using this method.

Confirm Data has been Recorded

Method 2: Using the Graphical User Interface

Select the database wherein the table is located and select the correct table.

Next, click on the “insert” tab and fill in the information accordingly. Remember that the emp_id field should be left empty because MySQL automatically generates the value for that!

If we browse the table after inserting two records, we would see the following:

Entering Data through GUI

Congratulations, you now know how to insert records into the table that you created! You can use the “Browse” tab to see that your records were entered.

End of Tutorial

Pages: 1 2 3