Let's say I have an SQL table of tuples (id, lastname, firstname, occupation) where all values are strings (ok, obviously id is a key).
I want to transform it to a table with tuples (id, lastid, firstid, occupid), where I only keep pointers to other tables that contain the actual values. I apologize if the example domain of names and occupations is not the best suited for this operation.
Obviously to create the other tables that will hold the data, I need to get all last names, unique, and insert them into a new table with an auto-generated key. The same with first names and occupations.
Having done that, is there a single transformation that can generate the new table containing the pointers (er, foreign keys) ?
Implementation uses SQLite, if it matters.