Structured Query Language (SQL) is used to select, retrieve, add and delete data within a database (a collection of related tables). You can update one or more columns within the tables of your database in your SQL statement, setting the values of your fields to what you want them to contain. By using the WHERE clause, you can specify which fields you want to update and keep from updating all your records unintentionally.
Use the following SQL syntax to update the content in multiple columns in your database:
SET Col1 = value, Col2 = value
WHERE Col5 = value
Replace "Table" with the database table you want to update. For example, to update the table, "STUDENTS," you would add the following:
Replace "Col1" and "Col2" with the column names (fields) you want to update. For example, to update the columns "FirstName," "LastName" and "Address," you would add the following:
SET FirstName = value, LastName = value, Address = value
SET Students.FirstName = value, Students.LastName = value, Students.Address = value
Replace "Col5" after the WHERE clause and "value" with the matching column. For example, to only update the column where the student's last name matches "Dodsworth," you would add:
WHERE LastName = 'Dodsworth'
WHERE Students.LastName = 'Dodsworth'
How Do I Set a Dropdown List Box in Excel to Allow Multiple Selects?
Microsoft Excel is an excellent program for entering and organizing data of any kind. However, sometimes repetitive data entry can get tedious...
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...