views:

19

answers:

0

I was wondering if there were techniques or tools out there that would let me take a multi-table SELECT statement, complete with inner and outer joins, and determine after running it exactly which rows in each table are required to make the same SELECT return the identical rowset in a mini version of the database?

The ideal would be to generate a series of insert statements for each table that I could then run as preparation for a unit test of a sort involving my SELECT statement.

I know that foreign key constraints can get in the way of blind INSERTS but was curious if anyone knows of clever work involving finding out the appropriate rows for each table, relaxing constraints, inserting the appropriate rows, then re-enabling the constraints?