Hostel Database Setup

A

andreainpanama

Thanks to all of you for all of your help.

I have a small backpackers hostel and I am currently working on a database
to help me keep track of all of my guests.

These are the two basic design issues that I am running into.

Issue 1. Sometimes, there are 2 or 3 guests staying to gether in a private
room (as opposed to individuals staying in dorm beds which are always
registered separately). Since we rent the private rooms by the room, groups
are considered to be one booking and one stay in one room, even though there
are three individuals. I want to keep track not only of the guest that is
the official guest in my register (the one who pays for the room), but the 2
people who are accompanying him. Why? Because I a) want to know how many
different individuals have walked through my doors b) I want to know the
nationalities of every individual and c) Many times one of the people who
have stayed as a friend of a guest in a private room, will come back on their
own a few days later, and then they might become the paying guest or an
individual in a dorm. Therefore, I want a way that every single person has a
client ID number.

I have managed to do this rather haphazardly...by having a table with the
following fields,

MAIN GUEST 1(TITLE)
clientid1
lastname1
firstname1
nationality1
etc1
FRIEND2 (TITLE)
clientid2
lastname2
firstname2
nationality2
etc2
FRIEND 3 (TITLE)
clientid3
lastname3
firstname3
nationality3
etc3

And I just go in and manually assign a number to each person. Tried using
subforms, could't get them to work. Didn't use autonumbers because I wasn't
sure how to deal with the following Issue 2 below.....

Issue 2. Repeat Bookings. I currently have a booking table which allows
each guest to have a booking with dates, prices, room choice, etc. How do I
deal with repeat bookings of the same person? How do I structure tables and
forms to deal with the infinite amount of booking data that might apply to
one guest since I have no idea if a person will come back 0 times, or 3 times
or 65 times, or if they will be in the same room the next night, etc. How do
I limit my table and form size? How can I pull up a client number say 55,
and then enter new booking records? Should I do this with individual booking
tables? And once again, are my problems solve with autonumbers?


Finally, let me explain why I want this data...

To present real and true financial and marketing data to perspective buyers
of my business.
To answer my guests questions, eg, "How many guests have you had?" "What
country are the majority of your guests from?" "How many Swiss visitors have
you had?" "Are most of your guests under 30?" etc.


I would really appreciate someone's opinions.


(PS, I am a relative newbie, and know nothing about programming language.)

AndreainPanama

you can see my webpage at www.purplehousehostel.com
 
A

Amy Blankenship

Try this:

Clients
=======
ClientID
LastName
FirstName
NationalityID

Rooms
=======
RoomID
RoomNo
NumberofBeds
etc.

RoomStay
========
StayID
RoomID
StayBegin
StayEnd

ClientRoomStay
=========
StayID
ClientID
IsMainClient

Nationalities
=========
NationalityID
NationalityName
etc.

Then you want to make a Rooms form. Insert a new subform into your Rooms
form that uses RoomStay as a data source. That will need controls for the
stay beginning and the stay end, but the RoomID will be set by the
LinkMaster/LinkChild relationship between Rooms and RoomStay. If you used a
wizard, it would have inserted a visible control for that field. Leave it
on the form, but set its visible property to false. Also hide the StayID
field, since users won't need to set it.

You'll also want to insert a subform control on the RoomStay subform. Use
ClientRoomStay as the data source for it. Its StayID will be set by the
LinkMaster/LinkChild relationship between it and RoomStay. Again, hide the
StayID field. Leave the IsMainClient check box as is.

Now things get a little tricky. If you inserted the subform with a wizard,
it probably gave you a control for ClientID. Select Format>Change To, and
change it to a combobox control instead. Open the properties sheet for the
combobox and go to the data tab. Click the ... on the row source line and
then show the Client table. Double-click ClientID, LastName, and FirstName
to move those fields to the query grid. Close the window, saving the
change.

Switch to the Format tab and set the column count to 3. Set the column
widths to 0"; 1"; 1".

Now click in the little box in the upper left of your ClientRoomStay
Subform. Change its default view to continuous form.

What you have will now allow you to select your clients from the combobox
and associate them with a particular stay in a room as well as specifying if
a client is the main client. You can manually enter clients in a different
form, or you can use the not in list event of the combobox to automatically
pop up a new client form if the name you enter in the combobox is not in the
database. I am not going through the steps for that here, as it has been
covered on many occasions.

HTH;

Amy
 
A

andreainpanama

Thank you for such a detailed response but I must admit that I got lost. I
will try to get a little further along in my thinking process and post again.


The truth is that I think I am going to need some professional help with
this project. (someone to do it for me!) Any recommendations of how I can
get cheap development help on line?
 
C

Craig Alexander Morrison

<Rooms
<=======
<RoomID
<RoomNo
<NumberofBeds
<etc.

Without commenting on the rest of your post, the above table suggestion
seems incomplete with no mention of indexes (although I am presuming the
invention RoomID represents a surrogate to stand in place of the Natural Key
for the purpose of Primary Key)

I trust you have advised to OP by private email that this table would
require two unique non nullable indexes to avoid duplicates.

Remember when you add these little ID fields you also need to ensure you
maintain data integrity.

Data integrity and consistency is of the utmost importance to the users. It
is a real problem in the real world; without a second unique non-null index
on the RoomNo field you could have 50 Room 101s. You may respond by saying
that you knew that, my suspicion is that the OP does not, but then if you
have already emailed them (or sent a correction to this newsgroup) about
your omission all is well.

RoomNo would appear to satisfy the requirements of a natural PK
(familiarity, minimality, stability, simplicity).

Please note very little would be gained by discussing Surrogate vs Natural
on this forum (there are justifications on some use of surrogates when the
natural PK fails some of the tests for suitability (familiarity, minimality,
stability, simplicity) however the automatic use of little ID fields
indicates an (let's be gentle (g)) unconsidered approach).
 
C

Craig Alexander Morrison

I have been in the habit of calling an Index on the Primary Key the Primary
Index, an index on a Primary Key or indeed any Candidate Key as a Unique
Index. An index on any other field called a Secondary Index. The majority of
indexing is on key fields be they Primary, Foreign, Alternate or Candidate
keys.

I accept that I use Index and Key almost interchangably on this newsgroup,
but then we tend to be discussing physical implementations here rather than
Theory or indeed logical design. To some extent logical design has been
foreshortened especially if your target database is a relational one. The
first cut data design from a CLDD with the target being a Relational
Database Manager is done largely by making every key an index. The only
decisions being made were which index in the tables designated as
"Operational Masters" should be clustered and this was usually the index
with the least dependant occurences.

In the old days I used to design my databases on paper, black and
whiteboards, even a spell using Visio, 99.99% of all my "logical" designs
are now on DB2 or Microsoft Access 2 (yes 2, no 32 index limit)

It is not largely irrelevant, Jet should (and does) implement these keys via
indexes.
 
D

David F. Cox

Hostels and Hotels often have a suprising number of "John Smiths"

David F. Cox
 
C

Craig Alexander Morrison

It is not largely irrelevant, Jet should (and does) implement these keys
via
indexes.

I will retract this slightly (remove "should") :- Jet and most if not all
other vendors have chosen to implement primary keys via indices (some refer
to this as an accident).

Any discussion on any other physical implementation is largely theoretical.
This is not the place for that.

The fact that for the last 15 years of development I have slipped into Keys
are Indexes is a compromise one has to make to make a living delivering
solutions with the products available.

Hell I even use SQL and that is something I hoped would have been replaced
by something Relational.
 
A

Amy Blankenship

Craig Alexander Morrison said:
<Rooms
<=======
<RoomID
<RoomNo
<NumberofBeds
<etc.

Without commenting on the rest of your post, the above table suggestion
seems incomplete with no mention of indexes (although I am presuming the
invention RoomID represents a surrogate to stand in place of the Natural
Key
for the purpose of Primary Key)

Whether Andrea chooses to designate the RoomID as a PK is her choice.
However, I'd suggest she use it at a minimum to establish the relationships
with other tables, since it uses less space than the actual text room
number.
I trust you have advised to OP by private email that this table would
require two unique non nullable indexes to avoid duplicates.

Not really. It's her own hostel. I doubt she's overly concerned she might
accidentally enter the same room twice in the database :).
Remember when you add these little ID fields you also need to ensure you
maintain data integrity.

Well, if you're a bank, yes. If you're a little hostel who just wants to
track clients more easily than a spread sheet, that's probably not your
primary concern.
Data integrity and consistency is of the utmost importance to the users.
It
is a real problem in the real world; without a second unique non-null
index
on the RoomNo field you could have 50 Room 101s.

In the real world, once the rooms have all been entered, most people stop.
You may respond by saying
that you knew that, my suspicion is that the OP does not, but then if you
have already emailed them (or sent a correction to this newsgroup) about
your omission all is well.

RoomNo would appear to satisfy the requirements of a natural PK
(familiarity, minimality, stability, simplicity).

Please note very little would be gained by discussing Surrogate vs Natural
on this forum (there are justifications on some use of surrogates when the
natural PK fails some of the tests for suitability (familiarity,
minimality,
stability, simplicity) however the automatic use of little ID fields
indicates an (let's be gentle (g)) unconsidered approach).

Or it indicates that in practice I've found that automatically adding an
autonumber to each table eventually comes in handy. For instance, what if
you repainted all the rooms and someone accidentally switched two of the
room numbers around? This is easy to fix with a surrogate key, harder with a
natural key. It's hardly unconsidered, considering <g> that there are a
large number of highly skilled developers that agree with me.
http://www.dbpd.com/vault/9805xtra.htm

I think it's really rude to hijack a user's simple request for help with a
theoretical debate that goes far beyond the question at hand and delves into
esoteric points that the user probably isn't to a point in her development
career where she is ready to care about them. If I'm wrong and she is as
concerned about the theory behind what she's doing as just getting the
database to work, she should read the article posted above for a more
complete discussion of the issue, rather than your one point harangue that
doesn't give much context for her to make an informed decision.

-Amy
 
A

Amy Blankenship

Jamie Collins said:
How do you know whether today's Jean Dupont from France is the Jean
Dupont from France who stayed here in July last year or is the Jean
Dupont from France who stayed here in July last year e.g. do you
require them to quote their ClientID number when repeat booking?

Since she hasn't specified any need to know more about the client than
nationality, I'm not sure this is significant. One Jean Dupont from France
is as good as another, except of course if they are staying there at the
same time. And even then the difference may not be significant in terms of
the database, depending on what she is using it for.

If she wants to identify down to the actual person level, she will need more
information, such as address. Even that is subject to change. However,
that may not really matter, since I'm not sure there's any realistic
downside in a hostel database of having two entries for the same person at
different addresses.

That does bring up an interesting point, however, which is that if she wants
to distinguish Jean Dupont from France from Jean Dupont from Belgium, she
would need to add the nationalities to the combobox.
Another approach could be to record their passport number, with perhaps
a different identiifer for locals.

That will go over well with clients :).
Also note that NationalityID might be better as country of residence
using the ISO 3166 standard country codes.

Sure, if you have the list handy and feel like entering them all.

-Amy
 
C

Craig Alexander Morrison

In the real world, once the rooms have all been entered, most people stop.

The database is there to maintain data integrity, not the desk clerk, what
if one person entered a room twice?

Without defining the natural key you are plain WRONG.

I'd suggest she use it at a minimum to establish the relationships
with other tables, since it uses less space than the actual text room
number.

What if the room numbers only required Text(3), how long is a Long Integer?
Answer 4 bytes.

This means you are WRONG again, unless they have more than 99 rooms on each
floor or more than 9 floors and then you might end up using 4 bytes. BTW 1TB
costs less than 1GB ten years ago.
 
C

Craig Alexander Morrison

PMFJI

<<<That will go over well with clients :).

In many countries it is a legal requirement to show/deposit passports and
travel papers. I would expect this to become the norm in most countries.

<<<< Sure, if you have the list handy and feel like entering them all.

Many ISO lists ares readily available to import into ones databases.
 
A

Amy Blankenship

Craig Alexander Morrison said:
The database is there to maintain data integrity, not the desk clerk, what
if one person entered a room twice?

Why would desk clerks be entering room numbers? Presumably this an initial
setup thing that wouldn't ever need to be touched again unless the hotel
expanded or for some reason the room numbers changed.

Do you ever answer posts yourself, or is your sole purpose on this board to
try to impress people with your theoretical knowledge by putting down the
posts of people who do?

-Amy
 
C

Craig Alexander Morrison

Been here since 1994 when it was MSACCESS, probably answered ten of
thousands of questions, admittedly not so much in recent years.

And your point to that is what... please don't correct you when you are
wrong?

Is the database not there to prevent data inconsistency is that what you are
inferring?

Is it impractical to ensure data consistency?

Indeed the DATABASE should prevent not only the desk clerk from entering a
duplicate room number it should also prevent the APPLICATION(S) from doing
so too.

The original questioner is going to be running a business on this database,
it is not some toy example, do you think you should be a bit more concerned
about data integrity?
 
A

Amy Blankenship

Craig Alexander Morrison said:
PMFJI

<<<That will go over well with clients :).

In many countries it is a legal requirement to show/deposit passports and
travel papers. I would expect this to become the norm in most countries.

Sure, but when you're wandering the Highlands and stop in any old where, see
if they *actually* ask for your passport like they're supposed to. More
than likely they just have you sign the register and go up to your room.
 
A

Amy Blankenship

Gees Louise. All she wants to do is track what countries her clients are
from...

She's not running Fort Knox.
 
A

Amy Blankenship

In that case, she would need to know more about the clients to distinguish
them...
 
C

Craig Alexander Morrison

Gees Louise. All she wants to do is track what countries her clients are

Well no what the OP actually wants is....

<<<<To present real and true financial and marketing data to perspective
buyers
of my business.
To answer my guests questions, eg, "How many guests have you had?" "What
country are the majority of your guests from?" "How many Swiss visitors have
you had?" "Are most of your guests under 30?" etc.>>>>

Did you read that, I think the OP is more concerned about data consistency
than you are.
She's not running Fort Knox.

Who gives a .... if it is a small business it is very important to the OP
every bit as important as data is to an international bank.

Any database that has financial implications is VERY important to the owners
of that data, you may not care but they do.
 
A

andreainpanama

When I woke up this morning and saw that there were over 20 postings to my
op, I thought, Oh no, what have I done, asking for professional help on this
site and now I have many developers offering me services and others
reprimanding them for advertising on this site!

Imagine my surprise and glee when I saw that all of these responses where
still actually related to my original post!

Thanks guys, but now I am more confused than ever. My original post said
what I want, but it didn't go into detail about what I currently have. I
will post back with a better description of my current set up, and hopefully
get some help in real world language. Are any of you available by phone?
It's really cheap to call from here.

Thanks so much,

Andrea
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top