![]() Copy all previous data from old table (renamed table) to newly created table.Create new table with same name as previous table have with desired column type.ĬREATE TABLE items ( id integer PRIMARY KEY, name text NOT NULL, stock_quantity real NOT NULL ).Now suppose you have to alter stock_quantity column to float using above steps you can achieve it by following the steps mentioned below: Id(int),name(text),stock_quantity(int), price(real) Let say we have one table called items which have below schema. Rename original table with different name.Ĭreate new table with same name as previous table have with desired column type.Ĭopy all previous data from old table (renamed table) to newly created table.Įxample table with all sql statements in steps, show table with three or four column only. ![]() But i found that there is a work around to update column type. But after searching i found that sqlite database does not support alter statement at column level. I have search in google that how can i change table schema to accept float value which is integer. Estimation app add item screenīut recently one of our customer request to change quantity field to accept float values. I want to update a column in table1 with a value from table2. Here in quantity field in earlier version we were using integer. sql - Update column with value from another table using SQLite - Stack Overflow Update column with value from another table using SQLite Ask Question Asked 8 years, 3 months ago Modified today Viewed 21k times 9 I have two SQLite tables. There is one screen in app where user can add item to estimation. This app gives facility to prepare estimates for the products/services they are selling. I have also used sqlite database in estimation app which is available on google play store. In android application you can find good wrappers for sqlite database. It also supports various data types like int, real for float, text for string and etc. This SQLite tutorial explains how to use the SQLite UPDATE statement with syntax and examples. It have nice facility for create, insert,update and delete statement. Sqlite database is a very nice and powerful database and can easily embedded in your application.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |