Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8677729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:32:18+00:00 2026-06-12T20:32:18+00:00

I have a simple problem which probably has a simple solution, but the solution

  • 0

I have a simple problem which probably has a simple solution, but the solution alludes me…
so I have a simple table i.e. phone that has 4 columns, and I want to add one new column. Since SQLite doesn’t modify tables I have to drop and create.

phone_old

_id integer primary key autoincrement,
name text not null,
value text

phone

_id integer primary key autoincrement,
name text not null,
itemState text not null,
value text

so I do the following :
1. I rename the old table,
2. I create the new one with the extra field (in my case it’s itemState) and
3. I select and insert everything defining a default value for itemstate.

1 ALTER TABLE Phone RENAME TO Phone_OLD;

2 CREATE table Phone(
_id integer primary key autoincrement, 
name text not null, 
itemState text not null, 
value text ); 

3) INSERT INTO Phone SELECT * , 'Synced' as itemState from Phone_OLD where Phone_OLD. ;

what happends as a result is that the item state (synced) is added as the last field and not in column 3 which is the itemState.

so the column names do not correspond to the row values, meaning the itemstate is added at the end (as the last column in the row and not as position 3 as it’s supposed to )

Just putting the itemstate at the end would solve the problem, but since my table creation statements are generated I would have to rewrite a whole bunch of code to do so, and to be hones it pisses me off that this set of queries returns crap..

any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:32:19+00:00Added an answer on June 12, 2026 at 8:32 pm

    Sqlite does support appending columns

     ALTER TABLE Phone ADD COLUMN [itemState] text not null default ''
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strange problem which probably has a very simple solution, I just
It looks like a problem which could have simple solution, but I haven't found
I have a simple text dictionary file, which contains words, separated by ';'.My problem
I have a very simple JavaScript/jquery code which won't just work correctly. The problem
I have a simple problem that I have not been able to find an
I have a simple problem while putting text in multiple table! please have a
I have a simple problem that I've been stuck on for some time and
I have a simple problem that i cannot solve. I have a dictionary: aa
I have a simple problem but I am not sure how to solve it.
I have a simple problem but no matter what I try I can't see

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.