Author |
Topic |
X-Factor
Constraint Violating Yak Guru
392 Posts |
Posted - 2009-01-27 : 07:06:00
|
Hi there,My application is selling chalets in a holiday camp. A user can buy an extra 'floor sleeper' ticket for their chalet but there is only a limited number of these extra tickets.Where do I store the count of these tickets? Its just a single value. So would that be a table with one column and one row?Cheers, XF. |
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2009-01-27 : 10:47:01
|
I'm confused. Do the chalets have a limited number of floors for people to sleep on?Is the number limited by room, or for the entire chalet?________________________________________________If it is not practically useful, then it is practically useless.________________________________________________ |
|
|
X-Factor
Constraint Violating Yak Guru
392 Posts |
Posted - 2009-01-27 : 20:39:29
|
The chalets come in a variety of sizes of normal beds (4, 5, 6, 7 & 8 berth) but any chalet can take one extra person on the floor. However, only the first x shoppers can buy an extra ticket for their chalet where x is the number I need to store and decrement. |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2009-01-27 : 23:59:30
|
OK. Still kind of odd, but here is one suggestion:Put a smallint column on your rooms table indicating whether a floor sleeper ticket was purchased for that room.Create a view that sums up the number of current floor sleepers in all rooms. That will tell you how many more floor sleepers you can accommodate.I think you are going to run into difficulties, though, if your room reservations don't all begin and end simultaneously.________________________________________________If it is not practically useful, then it is practically useless.________________________________________________ |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2009-01-28 : 04:12:48
|
I'd rather suggest that you create a table like this maybe:CREATE TABLE ObjectsForRent( ID int IDENTITY(1, 1) NOT NULL, ObjectName varchar(50) NOT NULL, TotalQuantity int NOT NULL, AvailableQuantity int NOT NULL, DailyRent decimal(8, 2) NOT NULL) Then you could add an object called FloorSleeper but you can also add canoes, bed sheets or whatever basically.- Lumbago |
|
|
X-Factor
Constraint Violating Yak Guru
392 Posts |
Posted - 2009-01-28 : 08:35:26
|
quote: I think you are going to run into difficulties, though, if your room reservations don't all begin and end simultaneously.
Its much more simple than that. Its just a one off event. When all chalets have been sold they just want to be able to cram in a few more people on the floor of some of the chalets.quote: Create a view that sums up the number of current floor sleepers in all rooms. That will tell you how many more floor sleepers you can accommodate.
Doesn't it just tell me how many floor sleeps there are currently? I still need a 'total allowable' number somewhere.quote: I'd rather suggest that you create a table like this maybe:
OK, so you're just fleshing out a single value. But under all that flexibility I'll probably only really be using one value! |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2009-01-28 : 09:50:11
|
quote: But under all that flexibility I'll probably only really be using one value!
So what? It's a table with one row...probably less than 1k of diskspace and a lot easier to work with than storing somewhere else...I don't see the problem.- Lumbago |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2009-01-28 : 10:05:01
|
quote: Originally posted by X-Factor Doesn't it just tell me how many floor sleeps there are currently? I still need a 'total allowable' number somewhere.
If this is a one-off event, I'd think you could just hard-code that value into the query or view.But then again, if this is a one-off event, I'm not sure why you are bothering to create a database for it in the first place.________________________________________________If it is not practically useful, then it is practically useless.________________________________________________ |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2009-01-28 : 10:14:10
|
quote: I still need a 'total allowable' number somewhere.
Did you even look at the columns in the table I posted...? < sarcasm >That's the genius of tables you know...you can have several columns for each row in the table < /sarcasm >- Lumbago |
|
|
X-Factor
Constraint Violating Yak Guru
392 Posts |
Posted - 2009-01-29 : 04:14:32
|
Chill out dudes...quote: But then again, if this is a one-off event, I'm not sure why you are bothering to create a database for it in the first place.
Where else would you store the details of thousands of people, their payments and the chalet that they've been assigned to?quote: Did you even look at the columns in the table I posted...? < sarcasm >That's the genius of tables you know...you can have several columns for each row in the table < /sarcasm >
I was replying to someone else's suggestion.Anyhow, thanks for the response. I don't have a problem with using an entire table to store a single value except I reckon its the sort of design that would get jumped on by the theorists. But maybe not... |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2009-01-29 : 10:35:56
|
quote: Originally posted by X-Factor Where else would you store the details of thousands of people, their payments and the chalet that they've been assigned to?
This must be one hellacious event. Now I'm feeling left out 'cause I haven't received an invitation.I'd even be willing to sleep on the floor...Seriously though, despite abhorring the idea of using spreadsheets as databases, I'd consider using Excel if this is a one-time event.________________________________________________If it is not practically useful, then it is practically useless.________________________________________________ |
|
|
X-Factor
Constraint Violating Yak Guru
392 Posts |
Posted - 2009-01-29 : 15:18:07
|
Yeah its a pretty crazy event.What advantage would using a spread sheet have? |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2009-01-29 : 17:10:07
|
The advantage of not having to go to the trouble of creating a relational database.All depends upon you business requirements, I suppose. Good luck.________________________________________________If it is not practically useful, then it is practically useless.________________________________________________ |
|
|
|