SQLite Forum


5 forum posts by user nylink

20:17 Reply: counter (artifact: 72aeeb0c47 user: nylink)

thank you, in this last example insert adds a record to the DB when I would need to keep only one value and increment it

15:33 Post: counter (artifact: 976fa30cf3 user: nylink)

I am looking to store a counter value that needs to be incremented from time to time

I have a table called file_number with a single field called num and just one record

to increment the counter I update the record:

UPDATE file_number SET num = num + 1

then to retrieve the value I do:

SELECT num FROM file_number LIMIT 1

is there a faster way to increment the value of the record and retrieve the value of it ?

is it efficient to store counters like this ?

16:35 Reply: select in order (artifact: b86e0913d0 user: nylink)

great! thank you!

16:05 Reply: select in order (artifact: 93216114f2 user: nylink)

Gunter there are obvious reasons why you would need the results in the order you submitted them

you need to be able to track your results as you receive them

having them returned in ASC order unless specified, doesn't make sense

ddevienne thanks a lot, great solution !

03:40 Post: select in order (artifact: 682f2627b3 user: nylink)

I have the following command:

SELECT * FROM products WHERE id IN (13,3,2,5,9,12,7)

it returns the results in ascending order

how do I get the results as I sent them ?


1 record:


2 record:


3 record: