New answers tagged

0

PRIMARY KEY(a) UNIQUE(a,b,c) In MySQL, a PK is Unique. So, given that a is UNIQUE, it is overkill to have that second index. If you ever lookup the id for a given name, then you need UNIQUE(branch_name). This table is one of the rare cases where two separate UNIQUE keys is called for. Otherwise, your Branches table seems reasonable. (You may decide that ...


0

Many things look "right". Here are some nit-picks. Banking has strict rules on rounding. FLOAT is the wrong datatype to use for money or even monthly_rate. See DECIMAL. You may want to keep Loans pristine. That is, find some other place to put the next month's due date. Transactions could use the sign of the amount to determine 'credit' vs '...


2

I see several issues: transactions.running_balance is not an attribute of the transaction, it's a denormalized attribute, because you should be able to SUM() the credits and debits and get the running balance that way. If you store the aggregate value as well, there's a chance it could disagree with the actual running balance. I mean, what if you were to ...


Top 50 recent answers are included