How to Update Multiple Columns


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:

    UPDATE Table

    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:

    UPDATE Students

  • 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'

Related Searches


Promoted By Zergnet


You May Also Like

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!