Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ku2
Starting Member
6 Posts |
Posted - 2008-05-20 : 04:02:48
|
hey guys how r u doing guys i need ur help in this RCA system which means Renting Car Agency... pls guys help me its a project i have some Qs which i tried to solve but faild here r the tables:create table Renter (RNO varchar2(5) primary key, RName varchar2(10), INCOME number, CITY varchar2(10));insert into Renter values('R1', 'NASSER', 12000, 'PARIS');insert into Renter values('R2', 'NASSIM', 13000, 'LONDON');insert into Renter values('R3', 'RABIH', 12400, 'LONDON');insert into Renter values('R4', 'AHLAM', 11500, 'PARIS');insert into Renter values('R5', 'RIYAD', 9500, 'DUBAI');create table Car (CNO varchar2(5) primary key, CName varchar2(10), AGE number, CITY varchar2(10));insert into Car values('C1', 'NISSAN', 1, 'LONDON');insert into Car values('C2', 'HONDA', 1, 'PARIS');insert into Car values('C3', 'MAZDA', 3, 'LONDON');insert into Car values('C4', 'MERCDES', 4, 'OSLO');insert into Car values('C5', 'BMW', 5, 'PARIS');insert into Car values('C6', 'TOYOTA', 1, 'LONDON');create table Contract ( RNO varchar2(5) not null references Renter, CNO varchar2(5) not null references Car, DNO varchar2(5) REFERENCES DRIVER, AMT number);alter table contract add constraint contrcat_pk primary key (RNO,CNO, DNO);insert into Contract values('R1','C1','D1',40);insert into Contract values('R1','C2','D1',30);insert into Contract values('R1','C3','D2',20);insert into Contract values('R1','C4','D2',30);insert into Contract values('R1','C5','D2',40);insert into Contract values('R1','C6','D2',50);insert into Contract values('R2','C1','D2',10);insert into Contract values('R2','C2','D3',10);insert into Contract values('R3','C3','D3',10);insert into Contract values('R4','C4','D4',20);insert into Contract values('R4','C5','D5',10);insert into Contract values('R4','C6','D5',10);the Qs are:1. get renter number for renters who rent at least one car rented by renter. ("at least one car" is not working wid me)2. get renter name, for renter who rent at least one car with one year car.3. get the age of the car the rented by renter R1.4. get car numbers for all car rented by more than one renter.5. get the car name that has 2 contracts.pleazzzzzzz guys help me i need itthax Ku2 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2008-05-20 : 04:15:57
|
| What have you tried so far? |
 |
|
|
ku2
Starting Member
6 Posts |
Posted - 2008-05-20 : 04:34:04
|
quote: Originally posted by RickD What have you tried so far?
hey,Q 1. Get renter number for Renter who rent at least one car rented by Renter R2…….?? The answer that I get only the half and there is some thing missing with is for the (rent at least one car):select RNO from contract where CNO IN (select CNO from contract where RNO = 'R2');Q2. get renter name for renter who rent at least one car with one year old.the answer is select r.RNAME from renter, car c, contract o where ( here i stoped :-(thax 4 passing Ku2 |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2008-05-20 : 05:21:44
|
| 1. I think you actually want:select RNO, CNO from contract where DNO IN (select DNO from contract where RNO = 'R2');3. The age of which car?4. All the cars are rented by more than 1, so that is simple.By the way, you are not using SQL Server for this, are you? At a guess, I would say theat this is Orable. |
 |
|
|
ku2
Starting Member
6 Posts |
Posted - 2008-05-20 : 06:24:54
|
quote: Originally posted by RickD 1. I think you actually want:select RNO, CNO from contract where DNO IN (select DNO from contract where RNO = 'R2');3. The age of which car?4. All the cars are rented by more than 1, so that is simple.By the way, you are not using SQL Server for this, are you? At a guess, I would say theat this is Orable.
 at college we are using SQL statment in Oracle (SQL plus) Ku2 |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2008-05-20 : 06:32:06
|
| This is a SQL Server forums, we could give you answers but they probably wouldn't work in Oracle. |
 |
|
|
ku2
Starting Member
6 Posts |
Posted - 2008-05-20 : 07:47:00
|
quote: Originally posted by RickD This is a SQL Server forums, we could give you answers but they probably wouldn't work in Oracle.
broo it works i read other ppl posts and tried them in SQL plus which u say is Oracle they worked perfectlyKu2 |
 |
|
|
ku2
Starting Member
6 Posts |
Posted - 2008-05-20 : 15:42:02
|
  thax dear RickD 4 trying 2 help Ku2 |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-05-20 : 15:46:17
|
quote: Originally posted by ku2
quote: Originally posted by RickD This is a SQL Server forums, we could give you answers but they probably wouldn't work in Oracle.
broo it works i read other ppl posts and tried them in SQL plus which u say is Oracle they worked perfectlyKu2
That doesn't mean T-SQL solutions will always work in Oracle. Wouldn't you want solutions that would definitely work in Oracle? There is an Oracle forum at dbforums.com.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
 |
|
|
ku2
Starting Member
6 Posts |
Posted - 2008-05-20 : 16:51:19
|
quote: Originally posted by tkizer
quote: Originally posted by ku2
quote: Originally posted by RickD This is a SQL Server forums, we could give you answers but they probably wouldn't work in Oracle.
broo it works i read other ppl posts and tried them in SQL plus which u say is Oracle they worked perfectlyKu2
That doesn't mean T-SQL solutions will always work in Oracle. Wouldn't you want solutions that would definitely work in Oracle? There is an Oracle forum at dbforums.com.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
aha i c.... now i got ui didnt know abt "T-SQL" I thought its same like oraclethax a lot dud i'll try dis one dbforums.com Ku2 |
 |
|
|
|
|
|
|
|