Well I know how factorials explode... I just want to know if its possible to create the specific update trigger?
-Panos
Main Topics
Browse All TopicsI have two tables:
1. FRIEND
2. MATCH_MY_FRIENDS
FRIEND is a simple table that captures some general attributes about my friends.
MATCH_MY_FRIENDS is a table with every possible combination of my friends (factorially).
I would like it that every time a record is added to 'FRIEND' a trigger is launched that updates the 'MATCH_MY_FRIENDS' table accordingly using factorial math. So here is an example:
I started with 4 friends. The MATCH_MY_FRIENDS table has 24 records in representing 4! (four factorial).
Now I add a record, so I have 5 friends. So I need an update trigger that autmatically inserts an additional 96 records.
I need the trigger to automatically generate the result of the 4! to 5! transformation.
Can this be done in MySQL?
-Panos
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
http://dev.mysql.com/doc/r
in the trigger, you would need to put 2 inserts:
* insert all existing rows in FRIEND with the new FRIEND
* insert all existing rows with new FRIEND and existing FRIEND
what is the exact table structure?
just to give you an idea of how big 60! is:
http://www.google.lu/searc
10! is already over 3 million rows...
Business Accounts
Answer for Membership
by: angelIIIPosted on 2006-08-06 at 23:17:43ID: 17261614
you should NOT try to match every FRIEND record to all other FRIEND records by default, as this will explose your table.
only insert those rows that really ARE friends.
just try to calculate 60! to quickly see that it won't fit any database, but you will probably have more than 60 records stored in FRIEND table...