An example of how to implement ALTER TABLE

I asked this question several times and still got the answer COMPLETE ... How to implement the ALTER TABLE statement to add a column to the database. Can someone PLEASE give me an example?

+5
source share
3 answers

Please read the SQLite ALTER TABLE reference , and this Android SQLite article :

database.execSQL("ALTER TABLE " + your_table_name + " ADD COLUMN " + new_col_name + " int");
+16
source
ALTER TABLE db_name.mytable ADD COLUMN column_name VARCHAR(30)

This is for SQLite. Other databases may indicate where the column will fit, but with the addition of SQLite to the end.

EDIT: . . - , 5 , . , , ( , SQL), , , SQL, -.

, : SQLite (O'Reilly) Android (O'Reilly). , ( 9), Android Android, SQLite SQLite.

, , , - , StackOverflow. ( ), , , .

, - , , .

+1

, , , alter table .

After two hours of trying, setting up file backup storage and what seemed viable, I realized that I did not include the new column in the “select query”, but still tried to extract data from the cursor, so there was no exception in the column.

+1
source

All Articles