开发者

Database , Employees with daily records [closed]

开发者_StackOverflow It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I am new to database, Please tell me how to make a database of Employee for Attendance, which contains a daily record of login/logout, please tell me how to manage 7 records (1 per day) for a single user, how to check this is new day and input will go to next day,

Thanks in advanced,


Simply, create one 'employees' table where each employe is identified by a unique field or primary key.
This table would typically contain the employee's name and additional contact info if you'd like.

Then we could just go with a simple logins table. Could be something like:

CREATE TABLE loginout (employeeID INTEGER NOT NULL, day DATE, login TIME, logout TIME,
                       FOREIGN KEY employeeID REFERENCES employees (employeeID ))

May want to add like a boolean field in the employees table 'isloggedin' or something to check for weather that employee is logged to handle error conditions, like if someone logs in and never logs out, then logs back in the next day. Stuff like that.

To check weather it's the next day already, then you'd use the 'day' field. You can get the current date in mysql (and other engines) with the NOW() function or you could get it client side to do comparison.

This question is pretty vague though, you should post your attempts at it and more specificially what aspect of it you're having trouble with.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜