Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Example of how to implement ALTER TABLE [duplicate]

Tags:

android

sqlite

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

like image 940
yoshi24 Avatar asked Jul 09 '11 02:07

yoshi24


People also ask

How do you create a duplicate data table?

Right-click the table you wish to duplicate, point to Script Table as, then point to CREATE to, and then select New Query Editor Window. Change the name of the table. Remove any columns that are not needed in the new table. Select Execute to create the new table.

How can I create a duplicate table in DBMS?

Right-click the table you want to copy in Database Explorer and select Duplicate Object.

What is the use of ALTER TABLE modify in SQL with examples?

The ALTER TABLE statement is used to add, delete, or modify columns in an existing table. The ALTER TABLE statement is also used to add and drop various constraints on an existing table.


1 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");
like image 140
IamAlexAlright Avatar answered Sep 22 '22 01:09

IamAlexAlright