SQL Server - about Tables in my project - Asked By praveenkumar on 27-May-11 07:46 AM

Hai..
   Am doing school management project.in that i want to staff details also.for that which tables i want to take.that means how to relate the staff and salary tables.and which fields i want to take in that two tables.please give me reply.
dipa ahuja replied to praveenkumar on 27-May-11 08:02 AM
check this:

Staff table

Staff_ID(Primary Key)
Name
Contact
Address

Salary

Staff_ID (Foreign Key)
Salary

Pat Hartman replied to praveenkumar on 27-May-11 08:34 PM
I would suggest some changes to the recommended schema.  People's names should always be a minimum of two fields.  I added a date to the salary table so you can tell when the salary was implemented.  I also added a unique index on the Staff_ID and SalaryStartDate because it doesn't make any sense to allow multiple salary records for the same date.  The second should supersede the first.

Staff table

Staff_ID(Primary Key)
FirstName
LastName
Contact
Address.....

Salary

Salary_ID(Primary Key)
Staff_ID (Foreign Key), (UniqueIDX, field1)
SalaryStartDate (UniqueIDX field2)
Salary
praveenkumar replied to Pat Hartman on 28-May-11 01:31 AM
Thank u for giving reply.But we hav to calculate their salary according their no.of working days.in which table we hav to take that field.