If you want to do mathematical calculations like that, text-based solutions can be quite challenging. Setting up a database before you know what you want to do is like starting to shoot a movie before the final scene is written.