Learning SQL: Part 4: UPDATE

Learning SQL

Structured Query Language (SQL) is a declarative programming language used for accessing data storied in relational databases. It appears in or is a core part of many common software packages like MySQL, PostgreSQL, Microsoft SQL Server, and Oracle Database.

In SQL, there are four common operations: SELECT, INSERT, UPDATE, and DELETE. Each of these corresponds in order to a primary action in relation to data: getting, adding, changing, and removing.


Changing data in a table uses the keyword UPDATE.

Table Name: People

Which Table?

Like using INSERT, the UPDATE keyword also needs to know what table to change.

UPDATE 'People'

After the name of the table to update comes what values to change. Like with FROM for the keyword SELECT and INTO for the keyword INSERTUPDATE uses another keyword SET.


The SET keyword pairs columns with values using the equal sign (=).

UPDATE 'People' SET Name = 'George'

For whatever is listed after SET to the next keyword, those values will be changed.


To avoid changing the whole table, some type of condition must be placed on what is being changed. For that, the keyword WHERE is used.

UPDATE 'People' SET Name = 'George' WHERE ID = '1'
Table Name: People

Mixed Equal Signs

Statements using the UPDATE keyword can often look confusing because of the use of SET with equal signs and the keyword WHERE with a possible equal sign meaning something different.

When an equal sign is used with SET, that pairs the value with its column name to be changed. When used with the keyword WHERE,  it is used in a Boolean sense: if two values are the same or not.

Quotations and Keywords

Depending on the software used with SQL, it may not use quotations around column and table names. Some allow for column and table names to appear as lowercase alongside the uppercase keywords. Nearly always, though, the keywords themselves appear as all-uppercase letters regardless of how the column and table names themselves appear.