Home Single table or multiple database tables
Reply: 1

Single table or multiple database tables

MrFoh
1#
MrFoh Published in 2015-01-13 09:24:00Z

Am working on a web app and I currently have three models 'User', 'Profile', 'CorporateProfile'. The Profile model serves a User who has an individual account and CorporateProfile for an corporate account. The tables; profiles and corporate_profiles have similar fields; street, city_id, phone, state_id. Am trying to figure out if it will be better to use a single profiles table to handle both User type accounts.

DB Schema

Users Table

  • id
  • email
  • password
  • first_name
  • last_name
  • name

Profile Table

  • id

  • user_id

  • photo

  • sex

  • dob

  • state_id

  • city_id

  • street

  • school_id

Corporate Profiles Table

  • id

  • user_id

  • logo

  • industry_id

  • state_id

  • city_id

  • street

  • description

Sloth
2#
Sloth Reply to 2015-01-13 09:28:05Z

it depends on what you main purpose is. If you have many selects on your database it may be better to keep these values in the tables. Otherwise it may be more valueable to make a new entity (ProfileInformation or something like that) to have shared values in one table

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.322273 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO