Forum Moderators: open
create table timesheet(
record_no int(12) auto_increment primary key,
emp_no int(6),
punch_in timestamp,
punch_out timestamp)
insert into timesheet(empno, punch_in) values (86,now());
mysql> select * from timesheet;
+-----------+--------+---------------------+---------------------+
| record_no | emp_no | punch_in | punch_out |
+-----------+--------+---------------------+---------------------+
| 1 | 86 | 2012-02-09 10:15:25 | 0000-00-00 00:00:00 |
| 2 | 99 | 2012-02-09 10:15:48 | 0000-00-00 00:00:00 |
+-----------+--------+---------------------+---------------------+
insert into timesheet(emp_no,punch_in) values (13,now());
mysql> update timesheet set punch_out=now() where emp_no=86;
select * from timesheet;
+-----------+--------+---------------------+---------------------+
| record_no | emp_no | punch_in | punch_out |
+-----------+--------+---------------------+---------------------+
| 1 | 86 | 2012-02-09 10:43:17 | 2012-02-09 10:43:17 |
| 2 | 99 | 2012-02-09 10:15:48 | 0000-00-00 00:00:00 |
| 3 | 13 | 2012-02-09 10:19:21 | 0000-00-00 00:00:00 |
+-----------+--------+---------------------+---------------------+