Answers.Body: <p>Quote from <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+data+architecture?desktop=true" rel="nofollow">CiviCRM data architecture</a>:</p>
  
  <blockquote>
    <p>When you add custom data to a CiviCRM object, you first create a
    custom data group and then add custom data fields. At the database
    layer, what you are doing is creating a new table for the custom data
    group and adding columns for the fields.</p>
  </blockquote>
  
  <p>If you crate a custom data group called <strong><em>My Custom Data</em></strong> with a field <strong><em>Name</em></strong>, Civi will create a new table in your database like this: <code>civicrm_value_my_custom_data_1</code>, <strong>1</strong> being the group id. The table has an id column (primary key) an entity_id column (fk to the entity, ie. contact_id, contribution_id, etc), and one column per each field you have created, in this case would be <code>name_1</code>.  </p>
  
  <p>Field <strong><em>Name</em></strong> for contact_id 50 in sql would be: 
  <code>select name_1 from civicrm_value_my_custom_data_1 where entity_id=50;</code></p>
  
  <p>Hope is clear.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-24T02:42:04.327Z
Answers.LastActivityDate: 2016-02-24T02:42:04.327Z
Answers.UserDisplayName: Andrei
Body: <p>I have a contribution form with profile with custom fields, I want to know where the custom fields data is stored in the DB for every new contact.</p>
  
Tags: <civicontribute><wordpress>
Title: Where are civicrm profile custom fields stored in the DB?
ThreadText: # Where are civicrm profile custom fields stored in the DB?
  
  (Asked by: username_0 on 2016-02-24)
  
  I have a contribution form with profile with custom fields, I want to know where the custom fields data is stored in the DB for every new contact.
  
  **Tags:** civicontribute, wordpress
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-02-24. Score: 4 | Accepted answer
  
  Quote from [CiviCRM data architecture](https://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+data+architecture?desktop=true):
  
  > When you add custom data to a CiviCRM object, you first create a
  > custom data group and then add custom data fields. At the database
  > layer, what you are doing is creating a new table for the custom data
  > group and adding columns for the fields.
  
  If you crate a custom data group called ***My Custom Data*** with a field ***Name***, Civi will create a new table in your database like this: `civicrm_value_my_custom_data_1`, **1** being the group id. The table has an id column (primary key) an entity\_id column (fk to the entity, ie. contact\_id, contribution\_id, etc), and one column per each field you have created, in this case would be `name_1`.
  
  Field ***Name*** for contact\_id 50 in sql would be:
  `select name_1 from civicrm_value_my_custom_data_1 where entity_id=50;`
  
  Hope is clear.
  
  
  ---
  
  