Hello,

I need to create ER + relational models. I've came across Embarcadero Studio Data architect, but I'm having some trouble using it.

What's the problem? I want the bottom table (PunctLucruActivitate) IDFirma to be in a relationship with IDFirma from the left table (PunctLucru). It won't let me do that.


Thanks for any help.

Here is the code:

CREATE TABLE PunctLucru 
   ( 
     IDPunctLucru NUMBER, CONSTRAINT IDPunctLucru_pk PRIMARY KEY(IDPunctLucru), 
   );

CREATE TABLE Activitate
   ( 
     IDActivitate NUMBER, CONSTRAINT IDActivitate_pk PRIMARY KEY(IDActivitate), 
   );

CREATE TABLE PunctLucruActivitate
   ( 
     IDActivitate NUMBER, CONSTRAINT IDActivitate_fk FOREIGN KEY(IDActivitate) REFERENCES Activitate(IDActivitate), 
     IDPunctLucru NUMBER, CONSTRAINT IDPunctLucru_fk FOREIGN KEY(IDPunctLucru) REFERENCES PunctLucru(IDPunctLucru),
     CONSTRAINT IDcampuri_pk PRIMARY KEY(IDActivitate, IDPunctLucru)
   );

Could I just finish the code and have the models automatically generated based on the tables/code?

Any tool that supports reverse engineering should do that for you.

Try using MS Visio for the purpose.

The picture is correct, your subsequent code just doesn't match it.

When you create an identifying relationship from parent to child, you will be migrating ALL parts of the primary key, e.g. from PunctLucru to PunctLucruActivate. If IDFirma is in the primary key (it is), it migrates.

Your picture shows IDFirma in the primary key of PunctLucru. Your code doesn't mention IDFirma in PunctLucru at all...it should be a foreign key to a third table (not in your picture, I guess). So the problem isn't with the tool. The problem is that your code doesn't reflect the picture.

Or am I just not understanding what you're after?