This article presents a proposal for a DB design related to a "Waiting list system".
Some types are described, from very simple versions to those with multiple functions.
Very simple
ERD
No difficult functions at all. You just to know the current number of people on the waiting list.
Tables
shops
Physical name | Logical name | Data type | Null | Note |
---|---|---|---|---|
id | ID | int | primary | |
Email address | varchar(255) | unique | ||
name | Shop name | varchar(255) | ||
counter | Sequential order | int | default: 0 |
Manage multiple waiting list
A single store can manage waiting list.
Use the "counters.counter" by incrementing it.
Possible use cases include multiple contact points, multiple products, and multiple branches.
ERD
Tables
shops
Physical name | Logical name | Data type | Null | Note |
---|---|---|---|---|
id | ID | int | primary | |
Email address | varchar(255) | unique | ||
name | Shop name | varchar(255) |
counters
Physical name | Logical name | Data type | Null | Note |
---|---|---|---|---|
id | ID | int | primary | |
shop_id | Shop ID | int | ||
counter | Sequential order | int | default: 0 |
Keep records
It keeps track of when a customer arrives and when they are called. Cancellations can also be made.
The number of people waiting is the number of counter_id specified in counter_histories excluding those containing checked_out_at and cancelled_at. (Refer to the SQL below)
SELECT COUNT(*) FROM counter_histories WHERE checked_out_at IS NULL OR canceled_at IS NULL;
SQLWith this level of functionality, it could be operated as a service at a minimum.
Tables
shops: Shop
Physical name | Logical name | Data type | Null | Note |
---|---|---|---|---|
id | ID | int | primary | |
Email address | varchar(255) | unique | ||
name | Shop name | varchar(255) |
counters: Sequential order
"name" column is supposed to include the date or an something name.
Physical name | Logical name | Data type | Null | Note |
---|---|---|---|---|
id | ID | int | primary | |
shop_id | Shop ID | int | ||
name | Counter name | varchar(255) |
counter_histories: Counter history
"name" column is assumed to be the name of the person waiting, the medical ticket number, or something else that will be displayed in the public queue. "checked_out_at" column puts the date and time when it is called. I was a little unsure if this was the right way to word it, so if you know the proper column name, it would be helpful if you could point it out.
Physical name | Logical name | Data type | Null | Note |
---|---|---|---|---|
id | ID | int | primary | |
counter_id | Counter ID | int | ||
name | Name of person waiting | varchar(255) | YES | |
checked_in_at | Date and time the line started | datetime | ||
checked_out_at | Date and time called | datetime | YES | |
canceled_at | Date and time of cancellation | datetime | YES |
コメント