Best data base design to store transient statuses of parking spaces at a parking lot
Hey. I'm designing a website (using spring, hibernate and postgres) for parking lot owners to keep track of the statuses(occupied or vacant or reserved) of the parking spaces at their parking lots and for everybody else my website should be able to display the current statuses of parking spaces in any parking开发者_StackOverflow中文版 lot they want to see.
Basically any parking lot owner can register with my website and can enter the information that contains the total number of parking spaces in their parking lot. So assume I have two entries in the parking_lots table with the details of two parking lots say A and B. A and B have unique ids, and say A has 7 parking spaces and B has 5.
Now my question here is what would be the best data base design to store the statuses of the 7 parking spaces in A, 5 in B and tomorrow if there's an entry C with say 3 parking spaces I should still be able to handle it. Suppose a user clicks on parking lot A at my website, he should be able to see which parking spaces in A are occupied, which are vacant and if any space is reserved for anytime in the future. The statuses can change at any minute in a day.
Any help will be greatly appreciated. Thanks in advance. Serotonin Chase
lot
-------
lot_id
name
address
space
________
lot_id
space_id
space_usage
-----------
space_id
filled_datetime
emptied_datetime
精彩评论