PDA

View Full Version : How to add a column in an SQLite database


Danijel.
22/06/2012, 05:24 AM
I was wondering how to add a new column at the END of the SQLite database because when i add a column it is on the beginning of the base.

Thank you.

ReneG
22/06/2012, 05:40 AM
I'm not sure if the native SQLite supports it, but this is the syntax.
http://www.sqlite.org/images/syntax/alter-table-stmt.gif
credits to whoever is the author @sqlite documenation

Lorenc_
22/06/2012, 06:08 AM
Add a column to a database? You mean a table right?

ALTER TABLE `table_name` ADD `column_name`;

You can select the format of the column by typing it after you write the column name:

ALTER TABLE `table_name` ADD `column_name` varchar(24);

Creates a string based on 24 characters for the new column. There is also a integer one which is simple 'INT' and instead of '24' you would insert the amount of digits that row would tend to use (maximum).

You don't have to even add the format afaik..