Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Database Structure For Application

  • 20-10-2013 01:20AM
    #1
    Registered Users, Registered Users 2 Posts: 434 ✭✭


    I am in the process of working with a MySQL database for resource bookings for a community center (volunteered again)

    I have many resources (rooms) with set opening and closing times (i.e. all rooms are available from 9am to 5pm daily except Sunday

    Bookings are broken down into hourly slots

    I have 3 tables in the database, Resources, Clients, Bookings.

    Resources contains the time, date, booking ID
    Clients contains client information, client ID
    Bookings basically marries up Resources and clients to form a booking

    Any tips on how i should proceed with DB, is what i have the leanest way of achieving this.

    Thanks
    Very Sleepy Developer


Comments

  • Registered Users, Registered Users 2 Posts: 4,846 ✭✭✭cython


    If I were doing that, I would probably move the date and time info associated with the booking to the bookings table, as that way you have largely unique information in each row of the resource/rooms table, and in the clients table. Under your approach it seems that for each booking, you would need to add a row in both the resources and booking tables, and potentially prepopulate the resources table for each slot to be booked, in turn linking them to the client in the booking. By moving the date/time as I mention, then all the "transactional" data is consolidated in one table, and the client/resources are largely static data


  • Registered Users, Registered Users 2 Posts: 1,757 ✭✭✭Deliverance XXV


    As it is not a very complex application I keep it simple and would go with something like:

    Room
    id *
    roomNum
    desc

    Client
    id *
    clientInfo/etc

    Booking
    id *
    clientID (Foreign key)
    roomID (Foreign key)
    bookingInfo/times/dates/etc

    Room and Client tables holds static information, and the Booking table holds all the booking records.


Advertisement