title: User profile database design
body: <p>i have to design a user account/profile tables for a university project. The basic idea i have is the following:</p>
  
  <ol>
  <li>a table for user account (email, username, pwd, and a bunch of other fields)</li>
  <li>a user profile table.</li>
  </ol>
  
  <p>It seems to me that there are two ways to model a user profile table:</p>
  
  <ol>
  <li><p>put all the fields in a table
  [UserProfileTable]</p>
  
  <pre><code>UserAccountID (FK)
  UserProfileID (PK)
  DOB            Date
  Gender         (the id of another table wich lists the possible gender)
  Hobby          varchar(200)
  SmallBio       varchar(200)
  Interests      varchar(200)
  </code></pre>
  
  <p>...</p></li>
  <li><p>Put the common fields in a table and design an ProfileFieldName table that will list
  all fields that we want. For example:</p>
  
  <pre><code>[ProfileFieldNameTable]
  
  ProfileFieldID int (PK)  
  Name           varchar 
  </code></pre></li>
  </ol>
  
  <p>Name will be 'hobby', 'bio', 'interests' etc...Finally, we will have a table that will associate profiles with profile fields:</p>
  
  <pre><code>[ProfileFieldTalbe]
  ProfileFieldID   int (PK)
  UserProfileID    FK    FK
  FieldContent     varchar
  </code></pre>
  
  <p>'FieldContent' will store a small text about hobbies, the bio of the user, his interests and so on.</p>
  
  <p>This way is extensible, meaning that in this way adding more fields corresponds to an <code>INSERT</code>. </p>
  
  <p>What do you think about this schema?</p>
  
  <p>One drawback is that to gather all profile information of a single user now i have to do a join. </p>
  
  <p>The second drawback is that the field 'FieldContent' is of type <code>varchar</code>. What if i want it to be of another type (<code>int</code>, <code>float</code>, a <code>date</code>, a FK to another table for listboxs etc...)?</p>