Databases & Dynamic Programming