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!
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.
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.
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.
The SQLite UPDATE statement is used to update existing records in a table in a SQLite database.
UPDATE users SET role=99 WHERE name='Fred'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With