1. Home
  2. Computing & Technology
  3. PHP / MySQL

MySQL Tutorial: Managing MySQL data

By , About.com Guide

1 of 4

Insert Into SQL - Add 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.

Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Learn MySQL
  5. MySQL Tutorial - MySQL Add - Insert Into SQL

©2009 About.com, a part of The New York Times Company.

All rights reserved.