i have this project in databases im supposed to
make for uni , creating a car rental system using java
and SQL server databases .
one of the requirements is to create a query that
will output the 3 most profitable cars .
the data about car rental profits is in another table
called past_rentals , each record in the table there
contains 1 past rental and the sum cost of that rent .
cars are identified by their car number .
the table looks something like
car number|..junk data about rent..|total cost|
what query can i use to pick the 3 most profitable cars
from the past_rentals table ? , im using microsoft sql server
2k developer edition .
note :it can be done easily with reading the whole
sorted table into java and then running on it , but it must
be done in an SQL query , without using java
..