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.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 SQL Newbie PK 1-Many

Author  Topic 

Keitherj
Starting Member

1 Post

Posted - 2008-12-23 : 01:11:19
Anyone smart....

The table structures below is what I am trying to accomplish. Kind of a 1-Many from Cities to Groups and then a 1-many from Groups to GroupAttributes.

tblCities:
CityName varchar(50), PK

tblGroups:
CityName varchar(50), PK, FK
GroupName varchar(50), PK

tblGroupAttributes:
CityName varchar(50), PK, FK
GroupName varchar(50), PK, FK
GroupAttributeName varchar(50), PK

It seems as though every db design I see in SQL uses an identity for the PK. I do not want to do this becasue I do not want dups in my data. Could someone critique my design on how it should be done in SQL more efficiently? Maybe I do not need these composite keys? Brand new to SQL.

Thanks
Keitherj

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-12-30 : 02:02:43
Based on what you are trying to accomplish - do you need "CityName" in the tblGroupAttributes table?
You already have the relationship in in "tblGroups" .



Jack Vamvas
--------------------
http://www.ITjobfeed.com
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-30 : 04:03:38
can one city be in more than 1 group? also why are you including cityname in groupattributes table? does attributename value differ for same group based on associated city value?
Go to Top of Page
   

- Advertisement -