T
T
terminator-light2018-08-22 15:49:23
Android
terminator-light, 2018-08-22 15:49:23

How to properly design a database structure in sqlite for an android application?

I'm going to write an application for testing. There is such a structure of the database
5b7d418a59cd2711649285.png
1. Each question can have any number of answer options,
2. Each question can have any number of correct answers,
3. Each question can consist of several categories,
4. Each answer option can be reused by different questions (may be correct in one question, wrong in another)
As for point 4, maybe it's worth removing the reuse and saving all the options entered by the user in a separate file and showing them in the AutoCompleteTextView when entering, and in the database in plain text instead of a separate table?
When adding an existing question to another category, it becomes necessary to copy records, the number of which matches the number of n options (copying occurs in CategoryQuestion (1 record) and in QuestionOption (n records)
Do sqlite use any ORM, or direct sql-
UPD:
I changed the structure a little:
5b7da13c55c3f312485477.png
2 foreign keys for the same field - is this normal or should not be done this way ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Semyon Semyonov, 2018-08-22
@man_without_face

It's easier with requests, less hassle, but learning ORM is a good thing, it will make life easier in the future.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question