hi All I was asked in a recent interview on designing a ID card system which employees use to access any zone/premises. This was a LLD question. My approach was to design simple tables for employee and premises and use a mapper table to map both.
Employee Table: employee_id, first_name, last_ name, designation...Premise Table: premise_id, premise_code, premise_name...Employee_premise_mapper_table: ONE to MANY: employee_premise_id, employee_id, premise_id.I added few other things like valid_upto to the Employee_premise_mapper_table to check if the user has access to the premise.
further the interviewer asked to add few more details like the last login time or the swipe in swipe out timing of the employee.
I used another table for mapping the timing to Employee_premise_mapper_table:
In_out_table: ONE_to_MANY: in_out_id, employee_premise_id, swipe_in_time, swipe_out_time, date.with this the employee can be tracked on how much time he was inside the premise:
I gave something sudo code/sql like:
select premise_name, sum(swipe_out_time - swipe_in_time) from In_out_table i, Employee_premise_mapper_table e
where e.employee_id = 123 and e.premise_id = CAFETERIA where i.date = '02-04-2019';after this the interviewer asked where is the card details which I also totally forgot.
I added another table as
ID_card table: ONE to MANY with employee: card_id, card_status, employee_id.I was disqualified from this round. how should I improve my answer or my throught process?
Another similar system design I have been asked are : design Google drive, tagging system, logger system, hit counter system, Splitwise and movie ticket booking system.
My approaches are fairly similar. I am trying to read ERD books but not much getting out of it.