I am working on an app where user can add credit/debit card and see their benefits in their list dashboard.
I have database table users, card type (debit/Credit), banks, cards and benefits.
Relationship
User to card — many to many
Card Type–Bank many to many
Card --Bank many to one
Card – Benefit many to many
Question
1 Is my database design needs improvement?
2 Also, I want to show list of Cards and corresponding benefits on the same list? is it
possible?
3 I tried above by creating a card list and using magic text…however when I added a magic
text to sum the benefit amount of 2 cards.
it is not adding ““if selected card are in have exactly same all benefits ( as there is many to many relation between cards & benefits they would be in same row””"…
Without knowing the business requirements of the app it is difficult to suggest the best possible solution. Given the information in your post, what I would do:
I’d avoid using M - M relationships in the DB Structure, unless it is absolutely necessary. I’m thinking about something like (M - M means many-to-many, 1 - M means one-to-many, M - 1 means many-to-one):
Bank - Card Type: M - M
Card Type - Card: 1 - M
Bank - Card: 1 - M
User - Card: 1 - M
As for Benefits, I’d attach them to Card Type. Both M - M and M - 1 is possible (I prefer the latter).
With this: a Card record uniquely belong to a User, have only one Card Type and uniquely belongs to the Bank.
User can have many Cards, with different Card Types, belonging to different Banks.
Banks can “share” Card Types (e.g. MasterCard Classic type of card could be issued by different banks).
Benefits in this scheme are attached to a Card Type. This means: if different banks offer different benefits for the same Card Type, then you’ll have to create a unique Card Type for each “set of benefits”.
What will my app do - People will select their card type and then bank and respective card variant from the dropdowns and will add it in their account.
Later, they can go to the card dashboard which would be the list of their all the benefit type and amount they have.
I am also sharing an excel of my database.
Also, I have around 350-400 rows and 6-7 column so around 5000+ fields. Will Adalo would be slow? such 400 rows considered heavy database?
3.Also, I am have such option of database-
A = User+ card type (with Benefit)+Bank
B = User+ card type +Bank+ Benefits database table
C = User+ card type +Bank+ Benefits 1 + Benefit 2 + Benefits 3 database table
D = User+ card type +Bank+ Benefits 1 + Benefit 2 + Benefits 3 +Amount (as there are repetitive amount) database table
Which database schema would be best?
I know this is a long question if you have time please response.
Have a nice day
Thank you, Victor…
AK