Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change a value in a column on a SQLite database?

Tags:

I have a SQLite database with this format:

TABLE users     |     |---------name - text     |     |---------avatar - text     |     |---------password - text     |     |---------userdir - text     |     |---------role - numeric 

I want to change the number of role. How could I change it? (I mean, what query?)

I'm using PHP if anyone needs it. Thanks!

like image 328
pmerino Avatar asked Jul 21 '11 13:07

pmerino


People also ask

How do I change the value of a column in SQLite?

Introduction to SQLite UPDATE statement First, specify the table where you want to update after the UPDATE clause. Second, set new value for each column of the table in the SET clause. Third, specify rows to update using a condition in the WHERE clause. The WHERE clause is optional.

How do I edit a SQLite table?

Summary. Use the ALTER TABLE statement to modify the structure of an existing table. Use ALTER TABLE table_name RENAME TO new_name statement to rename a table. Use ALTER TABLE table_name ADD COLUMN column_definition statement to add a column to a table.

Can you modify any table in any way or are there limits in SQLite?

SQLite supports a limited subset of ALTER TABLE. The ALTER TABLE command in SQLite allows these alterations of an existing table: it can be renamed; a column can be renamed; a column can be added to it; or a column can be dropped from it.

Which SQLite statement is used to update data into table?

The SQLite UPDATE statement is used to update existing records in a table in a SQLite database.


1 Answers

UPDATE users SET role=99 WHERE name='Fred' 
like image 81
Graham Borland Avatar answered Sep 21 '22 14:09

Graham Borland