Key and referential constraints play an important role in enforcing data integrity in database applications. Our study of database applications reveals that there are common patterns of database operations when implementing key and referential constraints enforcement. However, these patterns are not well documented and usually are hidden knowledge of developers. With the hypothesis that the patterns in database applications embody latent programming rules that developers commonly use, this paper presents an approach to mine these patterns by extracting from source code frequently appearing database operations and program constructs as partial order sets. Frequent patterns are then mined from the extracted partial order sets. Any deviation from these common patterns signals potential faults in the enforcement of key and referential constraints. Our experience of applying the approach on three industrial systems has shown that the extracted patterns are useful in assisting the verification of key and referential constraints enforcement.