Basj Basj - 5 months ago 9
SQL Question

Change only one column of one row in SQL

Let's say I have a SQLite database of 1000 rows with 10 columns named

col1, col2, ..., col9, id

How to change only the
of a specific row? Here is more or less what I want to achieve:

WITH mytable CHANGE col7 = 'newvalue' WHERE id = '156'

Is it possible to do it in 1 query? i.e. without having to read the whole row first, and repost the whole row, etc.


The syntax you're looking for is an update statement:

UPDATE mytable
SET    col7 = 'newvalue'
WHERE  id = '156'