I have a requirement which is to keep the data of 2000 employees attendance.
我有一个要求,就是保持2000名员工的出勤数据。
So the attendance table should have design?
那么考勤表应该有设计吗?
365 columns of each day in a year, 2000 pre-inserted records
一年一天365个栏目,2000个预先插入记录
And i will update it daily via java program
我将通过java程序每天更新它。
or
或
5 columns 2000 records daily insert for 365 days?
5栏2000记录每日插入365天?
Or is there any better approach?
或者有更好的方法吗?
1 个解决方案
#1
2
I think you're over-thinking things. Assuming you already have an employee table with the employees' details, all you really need is a another table with the employee's ID and the date (and possibly entrance and exit times, if you care about it), where the presence of a row indicates attendance on that date and the lack of if indicates lack of attendance. You can then find this absence days by left joining on the employee table.
我觉得你想得太多了。假设您已经有一个员工表和员工的细节,你真正需要的是与员工的ID和另一个表的日期(和可能的入口和出口,如果你关心它),连续的存在表明出席在日期和缺乏如果表明你缺乏出席。然后,你可以通过在员工表上的“左加入”来找到休假日。
CREATE TABLE employee (
id NUMBER PRIMARY KEY,
-- other details...
);
CREATE TABLE attendance (
employee_id NOT NULL REFERENCES employee(id),
attendance_date DATE NOT NULL,
PRIMARY_KEY(employee_id, attendance_date)
);
#1
2
I think you're over-thinking things. Assuming you already have an employee table with the employees' details, all you really need is a another table with the employee's ID and the date (and possibly entrance and exit times, if you care about it), where the presence of a row indicates attendance on that date and the lack of if indicates lack of attendance. You can then find this absence days by left joining on the employee table.
我觉得你想得太多了。假设您已经有一个员工表和员工的细节,你真正需要的是与员工的ID和另一个表的日期(和可能的入口和出口,如果你关心它),连续的存在表明出席在日期和缺乏如果表明你缺乏出席。然后,你可以通过在员工表上的“左加入”来找到休假日。
CREATE TABLE employee (
id NUMBER PRIMARY KEY,
-- other details...
);
CREATE TABLE attendance (
employee_id NOT NULL REFERENCES employee(id),
attendance_date DATE NOT NULL,
PRIMARY_KEY(employee_id, attendance_date)
);