Answer the question
In order to leave comments, you need to log in
Designing an e-journal database?
For the purpose of self-development, I set myself the task of creating an application, which is an electronic journal of the school.
I implemented most of the idea on Yii2, then I ran into the problem of updating the ratings in the database.
There is the following database structure:
fig. 1
Accordingly, the current_score table (current score) will be filled in as follows (from 1/09 to 31/05):
fig. 2
My task was to create a journal that can be filled in by the teacher in the context of subjects and students. That. the form for entering grades will be as follows:
fig. 3
And at this point I stopped. It turns out that when sending a POST request to update the form, 3 operations with the database (current_score table) will be performed: CREATE, UPDATE, DELETE.In other words, if new grades were entered, corresponding records are created; if grades were deleted from the cells of the form, the record data is deleted, and the usual update.
In order not to handle 3 operations, I considered various options such as:
Answer the question
In order to leave comments, you need to log in
No need to be smart here, do 3 operations and that's it. Don't focus on the number of transactions. Look at the cost of doing them.
Imagine how many grades a student will have in a year and delete them all with each editing? What if many users start editing at the same time? Wait until everyone deletes all their marks, and then writes them down again? IMHO stupid approach.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question