E
E
ElizabethP2020-05-17 10:32:57
Python
ElizabethP, 2020-05-17 10:32:57

How to calculate the sum of values ​​in a SQLite column?

Hello, I need to implement a table like this, the only question I have is how to implement the last row "total" so that the values ​​​​in it are recalculated when I add new records.
And how would it syntactically look like in python? Sorry for the possibly stupid question and thanks in advance for the replies.
5ec0e69d626f3033933230.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly, 2020-05-17
@MrCute

cur.execute("SELECT SUM(count) FROM users")
result = cur.fetchone()[0]

A
Arseny, 2020-05-17
Matytsyn @ArsenyMatytsyn

You can talk to the base in its language , for example.
Or go over the data already by means of PL in recursion .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question