Hi, I've just started working as a programmer at a web company. The other programmer there, does things a lot different from what I've been taught, and I'd just like some 3rd party advice on what other people think.
I'm actually in my last year of uni still, and I've learnt to design databases using ERD diagrams, making sure they're converted to 3rd normal form etc.
My work mate, didn't learn any of this, although he does have a much better understanding of databases then I due to his experiance. When we were designing a database the other day, I was drawing out a ERD and trying to make sure there was no redundency etc. But he would just write out the table structures not worrying about any of that. So I ended up disagreeing with his design, but he said that we should do it this way because his design was easier to query, and that there would be less of a load on the server.
Which sounded fair enough I guess, although I kinda thought the design didn't look right - it wasn't what I had been learning at uni.
anway, another strange thing he likes to do, is instead of using an associative entity where the primary key is made up from the primary key of two other entities, he likes to make it a seperate entity with it's own primary key and have the other tables link up via foriegn keys.
like this:
table entity1(
iID primary key
)
table entity2(
iID primary key
)
table entity3(
iID1
iID2
(iID1,iID2) primary key references (entity1.iID,entity2.iID)
)
but he likes to do it like:
table entity1(
iID primary key
)
table entity2(
iID primary key
)
table entity3(
iID primary key
iID2 foreign key references entity1.iID
iID2 foreign key references entity2.iID
)
Hope that made sense... I don't actually have the schema with me. He says he uses a seperate primary key for associative entites because it makes the queries easier. Is that good or bad practice?
Thank you
-Adam 🙂