scootermaster
Platinum Member
So it's been about 11 years since my DB class, and I don't remember thing one about it (except, of course, that there's something called "the relational calculus". A lot of good that's going to do me, eh?).
Anyway, I have a couple of DB schema questions:
I have this "source" db, with about 15,000 rows (but only 6ish columns), that I am using to populate a "new" database. I'm writing the parser that'll do all that. So two issues:
1). I want to link the row(s) of the new database to the row(s) in the old database they came from. Does it make sense to just add the 5 or so fields to the new db row, or use a foreign key? I can't see needing the old information all that often, but I do want to keep it around.
2). I'm exploding the old db to a bunch of different "types". Right now I'm using about 7ish tinyints (bits) as flags for which "type" the row is (the old db has none of this). There will be many different entities (mostly "names") which could have rows of many different types, and it would be common to want all the entries for a given name, regardless of type. So I figured it made sense to have one table, and use the bits to determine type, so with one query you could get all the entries of a given name, no join needed. Is is better/cleaner/more efficient to use different tables for each types and then use foreign keys? I can't use the primary key of name, because a given name may have multiple entries for a given name.
Thanks for your thoughts!
Anyway, I have a couple of DB schema questions:
I have this "source" db, with about 15,000 rows (but only 6ish columns), that I am using to populate a "new" database. I'm writing the parser that'll do all that. So two issues:
1). I want to link the row(s) of the new database to the row(s) in the old database they came from. Does it make sense to just add the 5 or so fields to the new db row, or use a foreign key? I can't see needing the old information all that often, but I do want to keep it around.
2). I'm exploding the old db to a bunch of different "types". Right now I'm using about 7ish tinyints (bits) as flags for which "type" the row is (the old db has none of this). There will be many different entities (mostly "names") which could have rows of many different types, and it would be common to want all the entries for a given name, regardless of type. So I figured it made sense to have one table, and use the bits to determine type, so with one query you could get all the entries of a given name, no join needed. Is is better/cleaner/more efficient to use different tables for each types and then use foreign keys? I can't use the primary key of name, because a given name may have multiple entries for a given name.
Thanks for your thoughts!