abduraooft
03-26-2009, 04:33 PM
Hi all,
I need some help to decide a good database schema for creating a system having multiple company-user entries.
Basically, a company act as a sub-admin, which can manage(add/edit/delete) users under that company. Thus of course, the company itself has a Username and a Password
Apart from the above two I need to have the following essential details for the company
Company_Id (a unique identification number, not sure from which table to take it right now)
Company short name(actually the Username for the company will be this value)
Company name
Email
Website
Address
Phone numbers
Maximum Intake
Similarly, a user will have
User_Id (again, to be taken from somewhere)
Company_Id (To relate a user with its company)
First name
Last name
Job title/Area of expertise
Email
Website
Address
Phone numbers
-----------------------
Now my plan is to have one table named Login having
Account_Id
Account_Type_Id (to differentiate normal user and company)
Username
Password
Email
Website
Address
Phone numbers
and then two separate tables named User and Company(having an Account_Id field in common, to relate with Login table) to store the remaining details of the above two types.
Would it OK, or do I need to consider anything else?
Do I need to have any auto_increment fields in the last two tables?
Sorry for this lengthy post and thanks for reading :)
I need some help to decide a good database schema for creating a system having multiple company-user entries.
Basically, a company act as a sub-admin, which can manage(add/edit/delete) users under that company. Thus of course, the company itself has a Username and a Password
Apart from the above two I need to have the following essential details for the company
Company_Id (a unique identification number, not sure from which table to take it right now)
Company short name(actually the Username for the company will be this value)
Company name
Website
Address
Phone numbers
Maximum Intake
Similarly, a user will have
User_Id (again, to be taken from somewhere)
Company_Id (To relate a user with its company)
First name
Last name
Job title/Area of expertise
Website
Address
Phone numbers
-----------------------
Now my plan is to have one table named Login having
Account_Id
Account_Type_Id (to differentiate normal user and company)
Username
Password
Website
Address
Phone numbers
and then two separate tables named User and Company(having an Account_Id field in common, to relate with Login table) to store the remaining details of the above two types.
Would it OK, or do I need to consider anything else?
Do I need to have any auto_increment fields in the last two tables?
Sorry for this lengthy post and thanks for reading :)