Mith
Mith

Reputation: 127

Google Contacts Address Book Schema - How to have 1 to many fields for data?

In Google Contacts, it seems that it allows you to many as many Email Address', Telephone numbers, Address', etc as you wish. You can simply keep clicking the add link to make as many fields as you want.

This makes me curious on how this is made in a schema?

Upvotes: 5

Views: 1839

Answers (1)

Pentium10
Pentium10

Reputation: 207922

There is a table that is named custom_fields (profileid,moduleid,fieldid,fieldlabel) there you define the fields eg: phone, dob, dogs, children then in another table custom_fields_values(contactid,fieldid,value) you set the values for each client/custom field.

custom_fields
-------------
user1,contacts,1000,Dogs
user1,contacts,1001,Children
user2,contacts,1002,Car Colour

custom_fields_values
-------------
120,1000,4
120,1001,0
121,1000,0
121,1001,0
122,1002,Red
123,1002,Transparent :)
124,1002,Green

Upvotes: 5

Related Questions