Abstract-Efficient data manipulation and retrieval is a fundamental part of many business processes in the majority of todays' companies. SQL, as a standard, is widely adopted and well accepted in this area. Students who set out to learn SQL frequently face difficulties. The learning process is to some extent inefficient, as the student's knowledge is afterwards often inadequate. Several computer-aided systems have been developed to alleviate the problem. However, most of them are static and rigid, because the system's knowledge is encoded manually. We propose a new system based on past attempts and solutions to SQL exercises. The proposed system is flexible and dynamic, as it adapts to the individual student and requires minimal intervention from domain experts. We show that the system is beneficial, in particular to students with low prior knowledge.