hi every one. i am making a booking app in vb.net and im using sql server as my database. i am confused about table creation. I have increment of 1 in customerid which is primary key in customer table. Suppose if a customer books a room and according to the increment id"1" is assign to the 1st customer. Now after some days same customer again comes to the hotel and books for a room. Now this time a different id would be assign to the customer according the the increment may be id"125". What to do if i want to search the customer for how many booking has he done so far. Because there would be different id's assigned to the same customer as every time he walks in to book a room different id would be assign to him. And suppose if i make surname as my primary key than may be other people will have the same surname. I am very much confused how to solve this search problem for a specific customer for all bookings he has done so far. And if i give a unique id to customer my self suppose "cust1" than every time customer walks in he has to remember his id. PLease give some ideas what to do

You will need to break out the information into more tables. You will need one table for registered guests (an id, their name, contact info, etc) and another for bookings. The bookings table will have a booking id and a guest id which links to the guest table. Then a guest can have multiple bookings matched against their one guest id.
The guest wouldn't need to know this guest id, you guest table would need to contain enough info to accurately describe him (first and last name, dob, maybe cell phone or email,

So do u think i should make guest id and surname as composite key or .i should do a combination of two keys.would it help?

yes.

create two different table like

Customer Table
+---------------------+
| Customer |
+---------------------+
| id (Primary) |
| Name |
| Bla bla bla |
+---------------------+

Booking Table
+-----------------------+
| Booking |
+-----------------------+
| booking_id (Primary) |
| customer_id (Forign) |
| date |
| Bla bla bla |
+-----------------------+

Now each customer have only one unique id where the booking is done as different id..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.