I am designing a database system to store salary information. It includes different tables (salary,personal info , ect)

I want to make it use for different companies. Also i want each set of data to be separated. (by company wise). (i.e. i dnt want all the employee names of every company in one table!!)
what would be the best database structure for that.??

i tried 1. one db for 1 company
That looks like invain.

please help me. I jst want an idea. thankx in advance

One employee cannot work for multiple company , have 2 table one for employee and one for company .

One employee cannot work for multiple company , have 2 table one for employee and one for company .

A table for employee with private info for each one sounds right to start with. Another table for companies with the company information also sounds right. The question is probably; where in lies the relation in between an employee and a company and how does it look like. The answer would probably result in another table filled with foreign keys involving both employees and companies. In this relational table, a foreign key involving one company is related to a foreign key to a employee. There can be several relations for a company to employees, meaning a company can have more than one employee. At the same time, there can be several relations for an employee to companies, meaning an employee can work for more than one company. By this understanding we can define this relational table as a "many-to-many". In conclusion, what I see are two tables that lists employees and companies, and a relational many-to-many table. Using this set of tables is easy when "where" query statement is used. Remember this... data in a database is of no usage if u cannot search for it, just like the complete Internet would be useless if information couldn't be retrieved from it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.