Wrox Programmer Forums HELP! Tables and queries in school project
 | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
 SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
 Welcome to the p2p.wrox.com Forums. You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
October 29th, 2005, 01:13 PM
 Registered User Join Date: Oct 2005 Location: , , . Posts: 1 Thanks: 0 Thanked 0 Times in 0 Posts
HELP! Tables and queries in school project

Hello,
I'm SQL beginner and I have a problem with design of tables and SQL queries for my school project. I need to design tables and SQL queries for simple car rental company. The problem is that I have a car and the car is rented for different prices according to month. Let's say:

* 100 per week in January
* 110 per week in Feruary
* etc. etc.

One can rent a car at least for a week but can rent a car for more weeks. The problem I cannot solve in some good way is how to count price of a car in the situation when car is rented for more weeks in different month where prices for week differ. Let's have an exmaple: client want to rent a car from 15.1. till 7.2., so this are two weeks in January and one week in February. The final price would be 100 + 100 + 110 = 310 (don't count weeks in this example; the point is that I have same dates and I need to get the information about prices in between these dates).
The simple algorithm is to get a price for every week and to add these prices then. But this leads to as many SQL queries as weeks I handle. Is it possible to do it in some better way? Can I design the tables and SQL queries in that way that I can get the price in one query?
Joseph.

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is OffTrackbacks are Off Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Parameter queries and make tables deanm5 Access VBA 1 April 13th, 2007 11:32 AM creating temporary tables instead of queries clwk Access VBA 4 March 12th, 2007 02:50 PM High School Project on Computer Programming Mercution Beginning PHP 0 June 6th, 2005 08:51 PM Blank fields - queries with many tables dvarrin Crystal Reports 0 February 1st, 2005 05:43 AM Tables & Queries question Kenny Alligood Access 2 July 14th, 2003 11:14 AM

All times are GMT -4. The time now is 11:53 PM.