Data Mining is the process of finding trends and patterns in large data. Association rule mining become one of the most important
techniques for extracting useful information such as regularities in the historical data. Query flocks extends the concept
of association rule mining with a ”generate-and-test” model for many different kind of patterns. This paper further extends
the query flocks with view definitions. Also, a new data mining architecture simply compiles the query flocks from datalog
to SQL. On this architecture, optimizations suitable for the extended query flocks are introduced. The prototype of the system
is developed on a commercial database environment. Advantages of the new design and the extension to the query flocks, together
with the optimizations, are also presented.