I have a table with a lot of repeated data that I'd like to refactor as 3 tables.
Current structure looks like:
meeting_desc
meeting_date
topic_desc
...
And the data in the current_table looks like:
meeting1,2/3/2009,abc
meeting1,2/3/2009,efg
meeting1,2/3/2009,xyz
meeting2,4/5/2009,aaa
meeting2,4/5/2009,bbb
I would like to create a meeting table and a topic table, with PKs coming from a sequence:
MEETING:
id
meeting_desc
meeting_date
TOPIC:
id
meeting_id
topic_desc
What I can't figure out is how to insert data into the new tables. I've tried:
insert into MEETING select distinct
seq.nextval, meeting_desc, meeting_date from current_table
but of course that doesn't work. Is there an easy way to normalize the data?