开发者

Phonebook database design

I am designing database for web base(ASP.NET) Phone-book - Contact manager software.

Each contact may has different phone types .. (Home , Work , Mobile ,etc ...) here is my database design :

Phonebook database design

Phone type contains for example :

  • Home
  • Work
  • Emergency or anything user wants.

M Is this well design ?

I think I'll have problem with this design that I can't displaying contacts with all their numbers (I mean each contact with all his numbers in one row not per number of contact one row) In a grid to user. What is your suggestion ?

I've to display all contacts with all Phone Types In 开发者_运维知识库a grid. I think I'll have problem to do that with current design .


I think I'll have problem with this design that I can't displaying contacts with all their numbers In a grid to user. What is your suggestion ?

You can do that with a simple query.

select c.contactid, c.contactname,
       pt.typetitle,
       pn.phoneno
from contact c
inner join phonenumber pn on pn.contactid = c.contactid
inner join phonetype pt on pt.phonetypeid = pn.phonetype

For data integrity, you're going to need some UNIQUE constraints in addition to your primary key constraints. If I were you, I'd consider UNIQUE constraints on ContactName, TypeTitle, and the pair (ContactID, PhoneType). In fact, the pair (ContactID, PhoneType) is probably a better primary key than PhoneID; consider dropping PhoneID entirely.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜