University of Rochester
   

Home
Web Help
Job Opportunities

IT Center
Class Tech
Computer Sales
Ed Tech
Site Licensing
Web Services


University IT Home

IT Notices

Policies

About Us

PMR

Leaders

Contact Us

MySQL with phpMyAdmin Tutorial



Inserting and Updating Data

Inserting Data

  • After selecting a database and table, click on the Insert tab.
    the insert tab
  • If your id field is set to auto-increment, you can leave it blank.
  • If you have a field of type date time, you can set its value to the current date and time using the NOW function.
    the datesubmitted field and now function
  • Fill in the rest of the fields.
  • Select either "Go back . . ." or "Insert another . . ." and press Go.
    the go back and insert another options

Editing a Single Row

  • Find the row that you want to edit using either the Browse or Select tab.
  • Click the edit link on the left of the row.
    the edit link of a row
  • Update any fields and press Go.

For More Advanced Updating:

Updating Multiple Rows (Using SQL codes)

  • You can use the SQL tab to run UPDATE queries or any other query.
    the SQL tab
  • Decide how to describe the data you want to update.
  • This is the general form of a query:
    • SELECT <fieldnames> FROM <tablename> WHERE <conditions>
  • Test your description using a SELECT query, for example:
    • SELECT id, firstname FROM people
      • selects all rows in table people and displays only the contents of the id and firstname fields
    • SELECT * FROM people
      • displays every field of every row in table people
    • SELECT id FROM people WHERE age > 21
      • displays the id of each row whose's age field is greater than 21
      • field age must be of type INT (integer)
    • SELECT id FROM people WHERE age >= 40 AND age < 65
      • displays the id of each row whose's age field is greater than or equal to 40 and less than 65
  • After pressing Go and viewing your selected data, edit your query by clicking on the edit link.
    query completed block
  • Update the selected rows by editing your query:
    • Replace the part of the query before the table name with UPDATE
    • Before the WHERE clause, add a "SET" clause, for example:
      • UPDATE people SET processed = 'yes' WHERE age = 18
      • UPDATE people SET age = 19 WHERE age = 18
  • "affected rows" text tells you how many rows modified.
    affected rows block
       

Text | Directory | Index | Contact | Calendar | News | Giving

Last Modified: Wednesday, 01-Feb-2006 14:42:03 EST