Answer the question
In order to leave comments, you need to log in
How to build the sqlite hierarchy and the algorithm for implementing the idea?
Hi everyone, I'm new to python. The idea is to write a telegram bot that will ask questions written in the database (sqlite). Questions will have their own hierarchy. For example, initially there will be 6 areas (sports, literature, etc.). When a person chooses a sport, questions about sports are already loaded from the database. And so on (such a vertical hierarchy that goes down). For example, when a person chooses football from the sport, questions about football will already be immersed. Can you please tell me how to implement this idea? (use global variables to know what topic we are in now (sport-football-RFPL championship)?; how to build a database?)
Answer the question
In order to leave comments, you need to log in
Forget about global variables.
Make two tables. The first is a tree.
id | name | parent_id
1 | Спорт | null
2 | Футбол | 1
3 | Чемпионат РФПЛ | 2
id | tree_id | data
1 | 3 | Инфа о чемпионате РФПЛ
select * from data where tree_id=3
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question