SQL Server - many to many join
Asked By user
10-May-07 11:41 PM
Can one add some extra data into the link table on a many to many join.
Currently it only contains two id's from each table as primary key.
Have a group table and a member table and a link table. Want to add a
'title' column but the only current table it could go in would be the
link table. Ok, or no?
TIA
SQL Server
(1)
CREATE TABLE
(1)
Table
(1)
Column
(1)
Tom Cooper replied...
Yes, if the attribute belongs to the link, and not either of the tables it
is linking, then the correct way to handle it is to add the attribute to the
link table. So if a person can be President of one group, and Treasurer of
another group, then title would go in the link table.
Tom
David Portas replied...
Don't obsess over sample design recipes and don't get mislead by
jargon. There is only one type of table. Some people find labels like
are just generalised lables, they are not design rules. Normalization
is the design rule that should tell you which table your data belongs
in.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
user replied...
I think I understand what you are saying. I am not obsessing but trying
to use common nomenclature to ask for some educated opinions. I took
normalization into consideration but still could not determine if my
thought was correct.
I have since detemined that an addition table will be required because
in fact members can have more than one title.
Thanks
user replied...
David Portas replied...
Boyce-Codd Normal Form. If the key of your "link table" is the
determinant for Title then Title belongs in that table. If not, it
doesn't.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
Access 2007-> SQL Server2005 "connection was forcibly closed", GNE 1 SQL Server SQL, Server2005, "connection, was, forcibly, closed", GNE, 1" / > Hi, with an Access 2007 application, I have a very big problem connecting an SQL Server 2005. The scenario: - nearly 200 clients with Windows XP Professional (in an Active Directory Domain clients uses WAN, LAN and WLAN, different locations - one SQL Server 2005 EE, uses actually 36 databases, the Access 2007 application uses 2 of them (one
Database Engine Tuning Advisor SQL Server I am trying to use the Database Engine Tuning Advisor. I have the developer edition Engine Tuning Advisor. When I start the Database Engine Tuning Advisor for either version of SQL I get the same message when I click Connect using either the sa account or to open a new connection. Additional information: Could not find stored procedure 'msdb. . sp_DTA_help_session'. (Microsoft SQL Server.Error:2812) I have checked and the stored procedure does not exist in msdb for either SQL05 or 08. - - Regards, James M SQL Server Tools Discussions SQL Server 2000 (1) SQL Server 2008 (1) SQL Server 2005 (1) AllDistinctDbIds.DatabaseID (1) IsDatabaseSelectedToTune
2 questions regarding db design: check constraint and many-to-many relationship SQL Server Hi, as I said earlier in this group that I am new to db design one way or the other. What are the basic guidelines in applying check constraints to table columns? 2. If two entities have a many-to-many relationship, for example, Roles vs. Users, we usually create a link table called UserRoleAssignments. Should we have a primary key for such link tables? Murach's SQL Server 2005 for Developers says that link tables usually do not have a primary key. But I would like to hear your second opinion. Thanks a lot. SQL Server Programming Discussions SQL Server 2000 (1) SQL Server 2005 (1) Virtual PC (1) Office
Moving database decrease performance SQL Server I have moved database from one SQL2000 on win server to another standalone computer. Both SQL serverers have the same settings, same service pack, enterprise editions. On both SQL servers are tempDB, log file and mdf file on separate disks. The new SQL server is on better computer, has more RAM, beter disks, stronger proc, but all queries are there some guide for this scenario somewhere on the net? Any suggestions? Thank you, Simon SQL Server Programming Discussions SQL Server 2008 (1) SQL Server 2000 (1) SQL Server Books (1
What's the go with sql server SQL Server I was just saying today that sql server is full of silly limitations and I seem to hit on a new one every that I found 2 in the space of 10 minutes. The first is if we create our own aggregate function in dot net then it has a limit of 8000 bytes features with more ways to manipulate things than you can poke a stick at. In sql server we don't even have a full range of date functions (a pretty basic