Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sql777
Constraint Violating Yak Guru
314 Posts |
Posted - 2007-11-01 : 15:26:37
|
| Hi,If I have 2 tables:TableAaIDaCountTableBbIDbCountAnd I need to create a 3rd table that will look like:aIDbIDWhat should I call this table?I've seen:relABAXBAny other naming conventions? |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-11-01 : 15:29:20
|
| We add the word "LINK" to the table name.Given a Product table, and an Image table, we would have a ProductImageLink table.Kristen |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2007-11-01 : 15:31:23
|
EDIT: Don't you have some work to do or something?I would usually do TableA_TableBThis enables a many to many and guantees only 1 combination of a thing if you put an unique key on the Relationship TableDo you need that?If TableA can only have 1 of a thing, then the TableB key gets stored in TableABrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-11-01 : 15:34:45
|
| "If TableA can only have 1 of a thing, then the TableB key gets stored in TableA"Is that the right way round Brett?Kristen |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
arorarahul.0688
Posting Yak Master
125 Posts |
Posted - 2007-11-02 : 03:36:07
|
| i think the easy descriptive way can becreate table ab_id or a_b_idRahul Arora MCA 07 BatchNCCE Israna, PanipatHRY, INDIA |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2007-11-02 : 09:00:17
|
quote: Originally posted by Kristen "If TableA can only have 1 of a thing, then the TableB key gets stored in TableA"Is that the right way round Brett?Kristen
Yes, 1 of a thing from tableB which is most likely a code tableDid you mean something else?Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-11-02 : 09:05:20
|
| Dunno, I just seem to be struggling with the sense of that sentence, buts it's probably just me.TableA = CustomersTableB = CountryTableA has a column for ID (PK) and a column for CountryCode - which joins to TableBTableB has a column for CountyCode (PK)So TableB has one row for "USA", TableA potentially has multiple rows for CountryCode = "USA"So I'm comfortable with "TableB key gets stored in TableA"Just not really understanding the "If TableA can only have 1 of a thing" because in this case TableA can have lots of "USA" CountryCode values.Sorry if I'm just being anal ...Kristen |
 |
|
|
|
|
|
|
|