database schema for timesheet

前端 未结 5 1893
青春惊慌失措
青春惊慌失措 2021-02-02 03:17

Could someone help me with a rough database schema for a timesheet application where the i would be able to

  1. Store hours per day for a time period ( 2 weeks ) fo

5条回答
  •  遥遥无期
    2021-02-02 03:54

    Here is a rough sketch that will give you a good start:

    Project
    -------
    ProjectId  PK
    ProjectName varchar(200)
    
    Employee
    ---------
    EmployeeId  PK
    EmployeeName (or first name/last name etc..)
    // .. other employee attributes
    
    
    ProjectTimesheet
    ----------------
    ProjectTimesheetId PK
    ProjectId          FK -> Project.ProjectId
    EmployeeId         FK -> Employee.EmployeeId
    StartTime          DATETIME
    EndTime            DATETIME
    Approved           bit
    

    EDIT: As an alternative to the approved flag in each ProjectTimesheet row, you could instead separate out the approved status to a separate table. For example, to allow approval for an employee's timesheet over a given period, a manager would add an approval entry to the Approval table:

    Approval
    --------
    ApprovalID    PK
    EmployeeId    FK -> Employee.EmployeeId
    StartTime     DATETIME
    EndTime       DATETIME
    ApprovedBy    FK -> Employee.EmployeeId (e.g. the manager)
    ApprovedDate  timestamp  // date the approval was registered
    

提交回复
热议问题