Primary Keys containing common foreign keys from different tables

I have 2 tables Table 1 and Table 2 which have primary keys which include
the same foreign key from a third Table 0.

Table 1 has a primary key consisting of  T1_KEY<pk> and T0_KEY<pk,fk>.
Table 2 has a primary key consisting of  T2_KEY<pk> and T0_KEY<pk,fk>.

Now I want Table 3 to reference both Table 1 and Table 2 so that it has a
primary key consisting of:
T3_KEY<pk>, T0_KEY<pk, fk>, T1_KEY<pk, fk>, T2_KEY<pk, fk>

I am trying to manually reverse engineer a database for which I only have a
verbal description.

I manage to achieve the above by creating a simple database using Sybase
Central. then reverse engineering it with PowerDesigner. However I don't
seem to be able to achieve the same result when starting at the Conceptual
Model. In the Physical Model I end up with a primary key lookin like this:
T3_KEY<pk>, T0_KEY<pk, fk>, T0_KEY<pk, fk>, T1_KEY<pk, fk>, T2_KEY<pk, fk>,
T2_T0_KEY<pk, fk>.

As you can see T0_KEY manifests itself twice once as T0_KEY and once as
T2_T0_KEY (T2 added automatically by PowerDesigner.

I hope this is understandable.

Thanks for any suggestions..


0
Mark
12/12/2003 2:24:42 PM
sybase.powerdesigner.general 9408 articles. 1 followers. Follow

2 Replies
1164 Views

Similar Articles

[PageSpeed] 4

This is expected behavior.  All you have to do is delete the second T0 key
column from T3.  PD will prompt you to replace the FK column with a
different column.  Select the first T0 key column.

-- 
Mike Nicewarner [TeamSybase]
http://www.datamodel.org
mike@nospam!datamodel.org
Sybase product enhancement requests:
http://www.isug.com/cgi-bin/ISUG2/submit_enhancement

"Mark Chapman" <mjc@killspamams.co.za> wrote in message
news:3fd9cfaa@forums-1-dub...
> I have 2 tables Table 1 and Table 2 which have primary keys which include
> the same foreign key from a third Table 0.
>
> Table 1 has a primary key consisting of  T1_KEY<pk> and T0_KEY<pk,fk>.
> Table 2 has a primary key consisting of  T2_KEY<pk> and T0_KEY<pk,fk>.
>
> Now I want Table 3 to reference both Table 1 and Table 2 so that it has a
> primary key consisting of:
> T3_KEY<pk>, T0_KEY<pk, fk>, T1_KEY<pk, fk>, T2_KEY<pk, fk>
>
> I am trying to manually reverse engineer a database for which I only have
a
> verbal description.
>
> I manage to achieve the above by creating a simple database using Sybase
> Central. then reverse engineering it with PowerDesigner. However I don't
> seem to be able to achieve the same result when starting at the Conceptual
> Model. In the Physical Model I end up with a primary key lookin like this:
> T3_KEY<pk>, T0_KEY<pk, fk>, T0_KEY<pk, fk>, T1_KEY<pk, fk>, T2_KEY<pk,
fk>,
> T2_T0_KEY<pk, fk>.
>
> As you can see T0_KEY manifests itself twice once as T0_KEY and once as
> T2_T0_KEY (T2 added automatically by PowerDesigner.
>
> I hope this is understandable.
>
> Thanks for any suggestions..
>
>


0
Mike
12/13/2003 4:45:28 AM
Thanks Mike.

"Mike Nicewarner" <psyclo@nospam_datamodel.org> wrote in message
news:3fda9968@forums-1-dub...
> This is expected behavior.  All you have to do is delete the second T0 key
> column from T3.  PD will prompt you to replace the FK column with a
> different column.  Select the first T0 key column.
>
> --
> Mike Nicewarner [TeamSybase]
> http://www.datamodel.org
> mike@nospam!datamodel.org
> Sybase product enhancement requests:
> http://www.isug.com/cgi-bin/ISUG2/submit_enhancement
>
> "Mark Chapman" <mjc@killspamams.co.za> wrote in message
> news:3fd9cfaa@forums-1-dub...
> > I have 2 tables Table 1 and Table 2 which have primary keys which
include
> > the same foreign key from a third Table 0.
> >
> > Table 1 has a primary key consisting of  T1_KEY<pk> and T0_KEY<pk,fk>.
> > Table 2 has a primary key consisting of  T2_KEY<pk> and T0_KEY<pk,fk>.
> >
> > Now I want Table 3 to reference both Table 1 and Table 2 so that it has
a
> > primary key consisting of:
> > T3_KEY<pk>, T0_KEY<pk, fk>, T1_KEY<pk, fk>, T2_KEY<pk, fk>
> >
> > I am trying to manually reverse engineer a database for which I only
have
> a
> > verbal description.
> >
> > I manage to achieve the above by creating a simple database using Sybase
> > Central. then reverse engineering it with PowerDesigner. However I don't
> > seem to be able to achieve the same result when starting at the
Conceptual
> > Model. In the Physical Model I end up with a primary key lookin like
this:
> > T3_KEY<pk>, T0_KEY<pk, fk>, T0_KEY<pk, fk>, T1_KEY<pk, fk>, T2_KEY<pk,
> fk>,
> > T2_T0_KEY<pk, fk>.
> >
> > As you can see T0_KEY manifests itself twice once as T0_KEY and once as
> > T2_T0_KEY (T2 added automatically by PowerDesigner.
> >
> > I hope this is understandable.
> >
> > Thanks for any suggestions..
> >
> >
>
>


0
Mark
12/15/2003 4:54:31 AM
Reply:

Similar Artilces:

binding 1 gridview to 2 tables having common column(primary key/foreign key)
Hi Friends Can anyone please tell me how to bind to 2 tables having a common column(primarykey/foreign key) to a gridview .the 2 tables have a common column(primarykey/foreign key).I want this in asp.net/vb project.Thank you.Gurjeet,England You can use DataSet, take a look at this link: http://msdn2.microsoft.com/en-us/library/system.data.dataset(d=ide).aspxWelcome to my SQL/ASPNET forum for Chinese http://51up.org/bbs/forumdisplay.php?fid=38...

integer primary/foreign key vs. varchar(255) primary/foreign key
Hello. Is there any principal performance (or some other) difference between using the integer primary/foreign key and using the string (varchar(255)) keys in queries that use tables joins? Server is Sybase SQL Anywhere 5.5.04 Yes! The primary key will only be made up of 12 bytes. By using an integer you ensure that your entire column is in the key. -- Jim Egan [TeamPS] Dynamic Data Solutions, Inc. http://www.dyn-data.com Houston, TX *********************************************************** Enterprise Applications in Your F...

Updating tables in sequence with primary key and foreign key relations
Hi all,        In my project i will have the  data in a collection of objects, I need to update series of tables with foreign key relations        Right now my code looks like this        foreach(object obj in Objects){        int accountId=Account.Insert(obj.accountOpenDate,obj.accountName);//this will update the accounts table and returns account id which is a Identity column in Acccounts table        int DebtId=Debt....

Keys, keys,keys...
Just installed PGP 6.5.8 and all is running fine, so far :-) Question: When I opened the PGP Keys window for the first time, apart from the *Create Key* wizard, there are about 50 odd keys belonging to various and sundry at NAI. Were these supplied for a purpose or only for illustration? Is there any reason they could not or should no be deleted? Question 2: I sent someone an encrypted test message using that person's public key. It went off fine except, I am left with only the encrypted eMail. What setting should I change in order for my eMail client (Outlook 2000) ...

Primary key
Hello, I've got a modeling problem betwin a conceptual model and a physical model and espacially about the foreign key. See below the illustrated exemple of the problem : -Whether the entity � ARTICLE � with two informations : CODE & WORDING -Whether the entity � UNITE � with two informations : CODE & WORDING An article has necesseraly three unity, the unity of command, of storage and of sails. These three unity can be differents. Conceptual model phycical model The generated physical model doesn't suitable me. How ...

SQL statement failed, no primary key value for foreign key ... in table ...
Problem: SQL statement failed, no primary key value for foreign key ... in table ... After deleting or changing primary key values in either consolidated or remote database. Question: Are there any triggers that can resolve inserting a record that has a foreign key value with no existing primary key value in primary table? Description: We have a serious problem with the dbremote program. I think it's a general problem that could appear in every database with related tables. Everytime the problem turns up we must create new remote databases from the consolidated datab...

Primary Key/Foreign Key
Can I use SQL Commands to add Primary key or reference keys to existed tables? (Not a new table, that's why I can't use CREATE TABLE command.) If does, could someone give me some sample codes? Thanks. Hi John, What you need is the ALTER TABLE statement. Look for it in SQLA help for the syntax. Regards, Nat. John Chyan wrote in message <35A4FF5D.5F192806@dissol.com>... >Can I use SQL Commands to add Primary key or reference keys to existed >tables? (Not a new table, that's why I can't use CREATE TABLE command.) > >If does, could someone ...

foreign key as a primary key
hi, I am using a foreign key (which is a primary key in a secondary table) as a primary key in a primary table. There is also another primary key in the primary table. Do You have to declare the foregin key as a primary key ? regards Jan Eikeland email:jaeikela@c2i.net url :http://home.c2i.net/jaeikela In article <368b0234.5056065@forums.powersoft.com>, jaeikela@c2i.net says... > hi, > > I am using a foreign key (which is a primary key in a secondary table) > as a primary key in a primary table. > There is also another primary key in the primary table...

AutoUpade UserId [Foreign Key] From the Primary Key UserId in the aspnet_Users table ?
 Hello everyoneI want the userId PrimaryKey in the aspnet_Users Table in the ASPNETDB.mdf  to Update it's foreign key in another table called ClientInfo in the same database, Once the User is created a new userId is created, i want this userId to be automatically entered in the foreign key table ClientInfo...how can that be accomplished?  You can have a trigger on aspnet_Users table doing the insert into the ClientInfo table.Regards,PrashantDont forget to click "Mark as Answer" on the post that helped you.  thanks for the fast reply..it would be great i...

primary key and foreign Key????
 Hi i have 2 table.. Table1UID         Username1               AB2               CD3               DD Table 2ITEM       Price          UIDPOO1      20.00          1POO2      10.00          2POO3       15.00         1 Now i am letting the Admin to delete the user in table1But since UID 1 and 2 are ...

Primary key/Foreign key again
Thanks, Nat and David. Under "SQL Anywhere", I get into ISQL to use "ALTER TABLE" command to add my primary key: ALTER TABLE Client ADD PRIMARY KEY (SYSID) I got an error: user 'dba' has the row in 'Client' locked. How can I release the locking condition? Click on another table in Sybase Central. Is suspect this is the issue. Dave Wolf Jaguar Product Team John Chyan wrote: > Thanks, Nat and David. > > Under "SQL Anywhere", I get into ISQL to use "ALTER TABLE" command > to add my primary key: > ...

Error: Primary key for row in table 'x' is referenced by foreign key 'f' in table 'y'
(ASA 9 newest ebf) I'm getting this error even though mentioned foreign key has cascade updates (and deletes too) enabled. Is this some new behaviour in asa 9, or why can i get such message for cascaded foreign key? Any ideas? Thanks Pete Found a reason for it...but should it really work so? It's this way: - table a has columns a,b,c - table b has columns a,c, and references columns a,c (with a,c) in table a with cascade updates - table a hes before update trigger to change columns a when column b is changed (set new_row.a = ...) and that set new_row.a = ... i...

Table design question (to foreign key or not to foreign key)
Our application is a message board and is full of messages, threads, and forums. A message is an individual entry (like the one I'm typing now ;)). Our software gives the user the ability to upload a single file attachment to each message. I can think of a couple different ways to design the two tables: message( messageid numeric identity, attachmentid numeric null, messagetext text, other, message, stuff... ) attachment( attachmentid numeric identity, title varchar, other, stuff ) or message( messageid, messagetext text, other, stuff ) attachment( messageid numeric foreig...

Attempt to over-write foreign key column "Code" where table A has 3 foreign keys to table X
Generating from CDM to Logical. PD 9.5.2.889 This is a weird one - 4 tables in my model have more than one foreign key reference to table COROrg. By default a foreign ket to COROrg generates as COROrgKy. I have renamed the other foreign keys appropriately - e.g. COROrgKyEmpGrp. After the rename when I generate from CDM to Logical everything's fine for all but on of the foreign key columns (i.e. the new name/code are maintained in all but one). The list of changes to happen (obtained from Merge dialog -> Merge Preview) says it's going to 'Modify Column "...

Web resources about - Primary Keys containing common foreign keys from different tables - sybase.powerdesigner.general

Ted Cruz Enrages An Entire City Over Offensive ‘New York Values’ Comment
Texas senator and 2016 presidential hopeful, Ted Cruz, is in the hot seat with the city of New York after a disparaging remark this week delivered ...

Microsoft updates support policy: new CPUs will require Windows 10, a list of preferred devices will ...
Ed Bott / ZDNet : Microsoft updates support policy: new CPUs will require Windows 10, a list of preferred devices will support older Windows ...

Leonardo DiCaprio, Tom Hardy celebrate Oscar nominations at ‘The Revenant’s London premiere
Cast and crew of 'The Revenant' including Leonardo DiCaprio, Tom Hardy, director Alejandro González Iñárritu and others celebrated their 12 Oscar ...

Chipotle Will Close Stores for Food Safety Meetings After Outbreaks
All Chipotle restaurants will open later than usual on Feb. 8 so employees can discuss safety changes, the chain said.

Warehouse worker takes third of Powerball jackpot
Concord Monitor Warehouse worker takes third of Powerball jackpot Concord Monitor John Robinson, left, brings in the family dog, Abby, as ...

El Chapo Reportedly Had Time for Erectile Disfunction Surgery While on the Run
After escaping from prison last summer, Mexico’s most powerful drug lord Joaquin “El Chapo” Guzman surely found himself with a busy schedule ...

Al Qaeda Targets Westerners in Burkina Faso: 20 Reported Dead
Terror has once again fallen upon the nation of Africa. Only a week after the Islamic State took credit for a series of attacks on popular resorts ...

'Prison Break' Revival Ordered Straight to Series
It’s really official – Prison Break is coming back. While Fox ordered a pilot episode back in the summer, the network just announced that the ...

Meet Jeb Bush’s police state: The NSA in charge of civilian data
Given the various recent terrorist attacks, it’s no wonder that hackers , cybersecurity, encryption and surveillance are all major topics of ...

French drug trial turns disastrous, leaving 1 brain dead and 5 hospitalized
Health Minister Marisol Touraine, pictured, told reporters that she was overwhelmed by the distress of the harmed volunteers. "Their lives have ...

Resources last updated: 1/16/2016 7:18:14 AM