473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Complex Data Relationship

Hi All,

I would like to describe a complex data relation that is required in a project, hoping someone can assist with the table schema.

I have been asked to write an application to handle the hiring of formal clothes for weddings, funerals, deb balls , etc. The hiring party may have anywhere from 1 to 25 people who need to be fitted.
Each person may have the same or different garments, but each will certainly have different size (and maybe color) requirements.
For example Fred comes in and hires a black Camry Jacket 48 sleeve, a Maroon Flair Waistcoat 42 Chest, Black London Trousers 42R, a standard White shirt 42 Chest 32 Neck and Black Cowboy boots Size 9.
So far, this is easy stuff.

However, when Fred books these garments for a wedding they are reserved for 2 days before and 2 days after the event. If for a Deb Ball, it is 1 day before and 1 day after. So the time the garments are reserved depends on the type of function Fred is attending.

Now, here is my problem.
When Fred comes in to select the jacket, trousers, etc that he likes, the attendant needs to know that the Camry Jacket 48 is available, but the Flair Waistcoat 42 is not. Take into account that, for some sizes, the are multiple garments. (The store may have 3x Camry Jackets 48 to rent, but only 2x Camry Jacket 46 for example).

Does anyone have any thoughts on how to structure the SQL tables so I am able to lookup garment availability based on Type/style/Color/Size/NumberToRent/FunctionPeriod without duplicating data in multiple tables?

Looking forward to hearing from you all :-)

Cheers,
Mark Chimes
Oct 9 '07 #1
3 1012
Shashi Sadasivan
1,435 Expert 1GB
This should have been posted in one of the sql forums, anyhows it will be shifted by someone hopefully.

so I came up with 5 types of tables[/size][/font]
1. Inventory (Name, Description, InventoryID(PK))
2. Type (InventoryID(FK), size, Type, colour, Stock, StockRented
3. Functions (FunctionID(PK), Name, PreRentDays, PostRentDays)
4. Customers (CustomerID(PK), Name,etc....)
5 Transactions (TransactionID(PK), TypeID(FK), CustomerID(FK), DateRented, DueDate, DateReturned, TotalCost, PaidCost)

does this make much sense?

cheers, happy coding!
Oct 9 '07 #2
[quote=Shashi Sadasivan]This should have been posted in one of the sql forums, anyhows it will be shifted by someone hopefully.

Sorry, I'm new to this forum.

So I came up with 5 types of tables[/size][/font]
1. Inventory (Name, Description, InventoryID(PK))
2. Type (InventoryID(FK), size, Type, colour, Stock, StockRented
3. Functions (FunctionID(PK), Name, PreRentDays, PostRentDays)
4. Customers (CustomerID(PK), Name,etc....)
5 Transactions (TransactionID(PK), TypeID(FK), CustomerID(FK), DateRented, DueDate, DateReturned, TotalCost, PaidCost)
does this make much sense?

Hmmm, I am still a little confused.
How do I know that a garment is available or not when booking out an existing garment?
The Type.StockRented column will not work as the one garment is booked multiple times in any month.
What is the Type.Stock column use for?


cheers,
Mark



cheers, happy coding!
Oct 9 '07 #3
Shashi Sadasivan
1,435 Expert 1GB
Hi Mark,

well..after a few shots around this site you will get your way around

Ok..the Type.Stock contains the number of items for that type which the shop owns (regardless if it is rented or not)

stockrented = the stock of that type which is currently out of the shop (being worn by someone else :P)

I assumed that there was no booking involved.
But however to the Transaction Table add a field called DateToRent

So now if a customer comes in, and want to book black pants32 size...qty = 2, for a certain date then you will have to go thru the transaction table and and for each of the rows which contain that typeID find those rows where date of booking falls inbetwee dateToRent and dueDate.
find the sum of the qty of those rows, compare it to Type.Stock, and you would know how many are availabe!

making any sense now?

cheers
Oct 9 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

39
by: | last post by:
I am trying to run the following agregate function in a parameterized query on Access2000: Min(.*sqr(./.)/) The query saved OK, but an attempt to run it results in the message: The expression...
28
by: Act | last post by:
Why is it suggested to not define data members as "protected"? Thanks for help!
0
by: davis | last post by:
ok I am new to xml and probably will use .net. my problem is I would like to read the xml file into a dataset, making it easy to navigate the data. however, my 1st xml file is simply too complex...
8
by: Matt | last post by:
Hi all, Thank you for taking the time. I have a database with 45 tables on it. 44 tables are linked to a main table through a one to one relationship. My question is, is there no way i can...
1
by: Steve | last post by:
I had a consultant develop a web-page reporting system for me, and last week I sat down and reviewed the undelying code. I have never seen something so complex for a system so simple. The...
8
by: Steve Jorgensen | last post by:
Mailing List management is a good example of a case where my conundrum arises. Say there is a m-m relationship between parties and groups - anyone can be a member of any combintation of groups. ...
1
by: Peter Rilling | last post by:
To minimize database calls, I would like to have a single stored procedure return all the data necessary to display on my page. This information is related from several different tables and what I...
2
by: Josef Meile | last post by:
Hi, I'm using a ComboBox, some Textboxes, and a DataGrid to represent a many-to-many relationship between Person and Course. Each time that I change the value in the ComboBox (which for now is...
9
by: jardar.maatje | last post by:
I am logging scientific data. For this a normal relationship database is not idéal but I am going to try it. I have basically three tables like: datarecord: * idx - integer * time - datetime...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.