Basj Basj - 2 years ago 69
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.

Answer Source

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

UPDATE mytable
SET    col7 = 'newvalue'
WHERE  id = '156'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download