Help With A Database Design Problem - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Help With A Database Design Problem (937 Views)
| 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): 10:03am On Dec 05, 2014*. Modified: 10:20am On Dec 05, 2014 |
CRAZYMADMAN: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:nice one, am happy for You ! |
Introduction To Database Design (video Tutorial For Beginners) • Retrieving/selecting A Particular Number Of Random Rows From A Database Table • Connecting To A Database Using Visual Basic • 2 • 3 • 4
Suggestions On Where To Buy It/comp. Sci Books • Needed Urgenly:A Programmer Dat Can Code In Results For Secondary School Website • Step By Step Guide On How To Learn Computer Programming On Windows 7