1. Computing

MySQL Tutorial: Managing MySQL data

By

1 of 4

Insert Into SQL - Add Data
MySQL Tutorial: Managing MySQL data
Once you have created a table you now need to add data into it. If you are using phpMyAdmin, you can manually enter in this information. First click on "people", the name of your table listed on the left hand side. Then on the right hand side, click the tab called "insert" and type in the data as shown (see above.)

You can view your work by clicking people, and then the browse tab.

A quicker way is to add in data from the query window (click the SQL icon in phpMyAdmin) or a command line by typing:

 INSERT INTO people VALUES ( "Jim", 45, 1.75, "2006-02-02 15:35:00" ), ( "Peggy", 6, 1.12, "2006-03-02 16:21:00" ) 

This inserts the data directly into the table "people" in the order shown. If you are unsure what order the fields in the database are, you can use this line instead:

 INSERT INTO people (name, date, height, age) VALUES ( "Jim", "2006-02-02 15:35:00", 1.27, 45 ) 

Here we first tell the database the order we are sending the values, and then the actual values.

  1. About.com
  2. Computing
  3. PHP / MySQL
  4. Learn MySQL
  5. Insert Data into MySQL

©2014 About.com. All rights reserved.