How to Update a Column in MySQL
MySQL is the most widely used open source database for web applications. Content management systems such as Drupal and Wordpress often require MySQL in their installations. It is also the database preferred by PHP developers and is commonly bundled with PHP and Apache web server in installation packages. MySQL comes with a command-line application called MySQL Monitor which allows you to execute SQL statements to insert, update and delete rows within your database. For those using MySQL bundled with PHP and Apache, a web application called phpMyAdmin also provides a MySQL control panel with a graphical user interface.
Instructions
-
Update Columns Using MySQL Monitor
-
1
Open MySQL monitor and log in with your username and password.
-
2
Select the database you wish to update. For example, to use the database named TARDIS, type in the following at the command prompt:
use TARDIS;
-
-
3
Type in the SQL statement to update your column. To update the Date column of a table named "Destination" where the Location is equal to "Gallifrey" you can use the following SQL statement:
UPDATE Destination
SET Date='2011-11-11'
WHERE Location='Gallifrey';
If updating more than one column, for example "Date" and "Time," you can use the following statement:
UPDATE Destination
SET Date='2011-11-11', Time='11:11:11'
WHERE Location='Gallifrey';
-
4
Press Enter to submit the changes.
Update Columns Using phpMyAdmin
-
5
Open phpMyAdmin and log in.
-
6
Click the name of the database you wish to update columns for.
-
7
Find the table you'd like to change, and click on the "Browse" icon next to it.
-
8
Put a check mark on all the records that need to be updated and click on the pencil icon or the "Change" icon.
-
9
Edit the text on all the columns you wish to update and click on "Go."
-
1
References
Resources
- Photo Credit Jupiterimages/Photos.com/Getty Images