SQLite UPDATE Query is utilized to change the current records in a table. You can utilize WHERE proviso with UPDATE question to refresh chosen columns, in any case all the lines would be refreshed.
Syntax
Following is the fundamental linguistic structure of UPDATE inquiry with WHERE condition.
UPDATE table_name
SET column1 = value1, column2 = value2...., columnN = valueN
WHERE [condition];
You can join N number of conditions utilizing AND OR administrators.
Example
Consider COMPANY table with the accompanying records −
ID NAME AGE ADDRESS SALARY
---------- ---------- ---------- ---------- ----------
1 Paul 32 California 20000.0
2 Allen 25 Texas 15000.0
3 Teddy 23 Norway 20000.0
4 Mark 25 Rich-Mond 65000.0
5 David 27 Texas 85000.0
6 Kim 22 South-Hall 45000.0
7 James 24 Houston 10000.0
Following is a model, which will refresh ADDRESS for a client whose ID is 6.
sqlite> UPDATE COMPANY SET ADDRESS = 'Texas' WHERE ID = 6;
Presently, COMPANY table will have the accompanying records.
ID NAME AGE ADDRESS SALARY
---------- ---------- ---------- ---------- ----------
1 Paul 32 California 20000.0
2 Allen 25 Texas 15000.0
3 Teddy 23 Norway 20000.0
4 Mark 25 Rich-Mond 65000.0
5 David 27 Texas 85000.0
6 Kim 22 Texas 45000.0
7 James 24 Houston 10000.0
On the off chance that you need to change all ADDRESS and SALARY segment esteems in COMPANY table, you don't have to utilize WHERE proviso and UPDATE question will be as per the following −
sqlite> UPDATE COMPANY SET ADDRESS = 'Texas', SALARY = 20000.00;
Presently, COMPANY table will have the accompanying records −
ID NAME AGE ADDRESS SALARY
---------- ---------- ---------- ---------- ----------
1 Paul 32 Texas 20000.0
2 Allen 25 Texas 20000.0
3 Teddy 23 Texas 20000.0
4 Mark 25 Texas 20000.0
5 David 27 Texas 20000.0
6 Kim 22 Texas 20000.0
7 James 24 Texas 20000.0