Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 29th, 2005, 01:13 PM
Registered User
 
Join Date: Oct 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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?
Thanks in advance.
Joseph.









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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.