What should be the structure of a mysql database in my case?

There is a challenge to create a table with users (name, balance)
each user can be some transaction, such as (a Fine prize)
So the question is, how do I organize the database structure? create a separate table for users and a separate transaction? And I these two tables to link please write the query for example to withdraw all fines user under the name Oleg
June 10th 19 at 15:34
1 answer
June 10th 19 at 15:36
Solution
Write a query difficult, because there is even an exemplary table structure of the database.
But I would have done exactly what you wrote. Just a little would improve.
Made three tables.
5a30e796b76d4107630784.jpeg

And the query would be something like this.
SELECT * from type_tranaction where i_user = 1 and i_type = 2
Better upload a picture on charasteric - marilyne_Roh commented on June 10th 19 at 15:39
could paint what answer fields in the transactions table? - nikita.Stracke commented on June 10th 19 at 15:42
in order
the user id in the table
Name
Surname

the record id
type id transaction
the value of TransAsia
the user id belongs to whom

id in the table
title (penalty/award) - Kamron29 commented on June 10th 19 at 15:45
sorry for the stupid question, but why the need for the id type of transaction ? - nikita.Stracke commented on June 10th 19 at 15:48
When you make a query sample, the type of transaction that best way is to contact code(id). And if you write
SELECT * from type_tranaction where i_user = 1 and i_type = fines
Would not be right.
In the extreme case at least
SELECT * from type_tranaction where i_user = 1 and i_type = shtraf
- Kamron29 commented on June 10th 19 at 15:51

Find more questions by tags MySQL