On Tue, Jan 11, 2011 at 7:10 AM, Serdel <[email protected]> wrote:
> I am wondering how can I insert an element at the beginning of the
> data base?

There is no such concept in modern databases.

> I want to do this because:
> a) I want to display the elements (ListView) as 'last-inserted on top
> and first-inserted on the bottom' (like a stack)
>
> b) I want to limit the amount of elements in my db. When a new element
> is added (over the limit) I can put the new one (at the beginning) and
> delete the last one. (Don't know yet how to delete the last element).

Set up a column that contains the timestamp of when you inserted the
row. You can even use a default value to populate this automatically.
Use the timestamp for sorting (e.g., ORDER BY clause).

For further assistance, please visit:

http://sqlite.org

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to