The first generation of databases has emerged since 1970's as hierarchical and network systems that unified data collection and manipulation as a single set of data records. The second generation has started since the early 1980 with the concept of relational databases and some variations such as object databases and deductive databases. The idea of moving databases toward the next generation has proposed since the 1990's as a better system to support new kinds of objects structures and business rules. With the advancement of data mining and learning techniques, we propose that the next generation database systems should include the learning capability. We therefore introduce the design of a query answering system that can support the database system to be more intelligent than the current systems. We also conduct some experiments to show the performance of the proposed query rewriting system.