₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,153 members, 8,420,584 topics. Date: Friday, 05 June 2026 at 04:37 AM

Toggle theme

Help With A Database Design Problem - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingHelp With A Database Design Problem (936 Views)

1 Reply (Go Down)

Help With A Database Design Problem by CRAZYMADMAN(op): 7:04am On Dec 05, 2014
I want to create a phonebook web app for a site that will have just the group name and the phone numbers. I have no problem with the PHP code, my problem is the design of the MySQL database, as one phonebook name should have many phone numbers, so what's character lenght should I set for the phone numbers or do I use different tables for that?

Please your help is highly appreciated.
Re: Help With A Database Design Problem by codemarshal08(m):
CRAZYMADMAN:
I want to create a phonebook web app for a site that will have just the group name and the phone numbers. I have no problem with the PHP code, my problem is the design of the MySQL database, as one phonebook name should have many phone numbers, so what's character lenght should I set for the phone numbers or do I use different tables for that?

Please your help is highly appreciated.
Let me give u a hint .
* Create two tables, one to store names and one for phone numbers
*The names' table should have a primary key column
*The Telephone Table should have a column that would reference the primary key column in the names' table(i.e Primary key of the names table used as a foriegn key here )
*For data types, You can use Integer for numeric fields e.g Primary Key, Telephone and VACHAR or TEXT for strings Field e.g names
*For the relationship, this should be ONE to MANY (One Person can have as many Phone numbers as Possible)
*Hope my tips would help.

NOTE: i am not an expert , i Believe we are all here to learn .

Re: Help With A Database Design Problem by javadoctor(m): 6:57pm On Dec 05, 2014
Create table group(

Group_id int,
Group_name varchar(32),
Primary key(Group_id)
);

Create table contact (

Group_id int,
Contact_id int,
Contact_name varchar (32),
Phone varchar(32),
Primary key(Contact_id),
Foreign key(Group_id) references group(Group_id)

);
Re: Help With A Database Design Problem by CRAZYMADMAN(op): 1:54pm On Dec 07, 2014
thanks guys. I think I know how to go about it now
Re: Help With A Database Design Problem by codemarshal08(m): 3:17pm On Dec 07, 2014
CRAZYMADMAN:
thanks guys. I think I know how to go about it now
nice one, am happy for You !
1 Reply

Introduction To Database Design (video Tutorial For Beginners)Retrieving/selecting A Particular Number Of Random Rows From A Database TableConnecting To A Database Using Visual Basic234

Hands-on Training On Basic Programmable Logic Controller(plc)Learn Software Development And Ethical HackingHot Demand!