1

I produced a relational model from my entity model and some of my entitiess now have primal keys that I didn't generate. I will provide some images from the diagrams. My Add entity In the realatioanl model Add entity

The problem is that these auto-generated keys translate to the ddl script generated from the relational model, like so:

`CREATE SEQUENCE add_add_id_seq START WITH 1 NOCACHE ORDER;`

And when I convert the script to MySQL, it produces these lines:

`CALL CreateSequence('add_add_id_seq', 1, 1);`

It calls procedures that I have not created so an error occures and the code isn't compiling. Why is this happening? What can I do to fix it? Thank you for your time. Here are the complete diagrams. Here is the entity model and here is the relational model.

Brad Troll
  • 13
  • 3
  • If you make a relationship, the keys are what bind them, so if you have a table that does not have a primary key, it needs one to tie that table to the other table, so it likely made them and inserted the values of the keys that were associated to them. – easleyfixed Jun 02 '23 at 21:49
  • If you've noticed in my diagrams the Em and Phone_Num entities have no assigned PKs. So, shouldn't this happen to them too? Shouldn't they have auto-generated a PK too? Why haven't they? (Nonetheless I'll try assigning some PKs to the problematic ones and see what happens. Thanks for answering! – Brad Troll Jun 02 '23 at 22:08
  • So basically as long as each table has their own primary keys, and the main table has a key that is also in the other tables to tie them all together, then it can tell there is a relation. Keep in mind if you add a relationship it will make deleting the source row impossible, so you will need to instead add an Inactive system to allow records to exist in the database to keep the relationships, but would indicate a status you could check on searchs to ignore inactive records. – easleyfixed Jun 06 '23 at 16:22

0 Answers0