not as simple as it sounds
It may surprise some but lawyers do not go to law school to find out what the law is.
Rather they educate themselves on "how to determine what the law is" given certain facts and in certain jurisdictions.
And there is a big difference between the two.
Once educated (no longer a lay person) certain methods and procedures can be put into play in order to make that determination.
It may also surprise many to learn that judges do not research and determine the law by their own efforts. By and large they rely on lawyers (at least one on each side) to do that research and make the argument as to what law applies. And, yes, if those lawyers are not adequately trained or skip the process, there is no telling what the decision might be.
No database is going to help the untrained. And yes, law school is between a 3 and 4 year study program not to mention the very tough bar exams that follow. And, those exams do not ask anyone what the law is on any point anywhere. Rather they are designed to bring out the ability of the student to evaluate the facts in light of what the law might be.
There are many reasons why lawyers have their own profession. And, yes, most judges are trained lawyers too. But, as pointed out, judges rely very heavily upon the lawyers to dig up the relevant law and argue how it should be applied to the case before the court.
If that system breaks down (or one side does not hire a lawyer or pay enough to get the work done) the decisions do come out wrong. Just like a pile of code that won't compile. The only difference is that few people know the decision was wrongly decided. Certainly not the lawyers and judge in the case. They did their best. But, it may still be wrong.