联系人数据库 [英] Contacts Database

查看:96
本文介绍了联系人数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我想开发手机的在线联络簿。但我有数据库管理的问题。例如我有用户,他/她有用户名,密码,电子邮件,电话号码等。此外,该用户还有他/她接受为朋友的联系人。如何有效地存储每个用户的联系人?我想我可以为每个新用户创建新的表,但它是没有效果的。任何人都可以提出任何建议或提供有关此问题的任何链接资源?

解决方案

创建一个 - 与联系人表的许多关系。该表将有2列:contact-id和friend-id。
两列都是该表的主键。


everybody. I want to develop online contacts book for mobile phones. But I have the problem with database management. For example I have user, he/she has username, password, email, phone number, etc... Also this user has contacts whom he/she accepted as friends. How can I store contacts for each user effectively? I think I can create new table for each new user but it is not effective. Can anyone suggest anything, or give any link, resource about this problem?

解决方案

Create a "friends" table with many-to-many relationship with the "contacts" table. That table will have 2 columns: "contact-id" and "friend-id". Both columns together are the primary key of that table.

这篇关于联系人数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆