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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 queries

Author  Topic 

Jeskit@hotmail.co.uk
Starting Member

20 Posts

Posted - 2007-12-12 : 09:15:34
hi

in my hoilday database, i need to write a query in sql that shows which shows the total cost of a hoilday per day. i'm having alot of trouble with this can anyone help me?

thanks

jessica

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-12-12 : 09:18:55
you need to at least show us the table for us to help you


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Jeskit@hotmail.co.uk
Starting Member

20 Posts

Posted - 2007-12-12 : 09:26:38
ok
the table is below:

CREATE TABLE Details_of_hoilday
(
Code_of_hoildays VARCHAR2 (20),
Country_visited VARCHAR2 (200),
Duration NUMBER,
Hoilday_code VARCHAR2 (30),
Description_of_hoilday VARCHAR2 (300),
Total_cost NUMBER,
PRIMARY KEY (Code_of_hoildays),
FOREIGN KEY (Hoilday_code)
REFERENCES Difficulty_ratings (Hoilday_code)
);

INSERT INTO Details_of_hoilday VALUES ('H1','USA','10','B','Yosemite and California','749');
INSERT INTO Details_of_hoilday VALUES ('H2','USA','16','C','Western National Park','1400');
INSERT INTO Details_of_hoilday VALUES ('H3','USA','21','E','Yellowstone','1021');
INSERT INTO Details_of_hoilday VALUES ('H4','India','10','B','Moghul Sites','1095');
INSERT INTO Details_of_hoilday VALUES ('H5','India','21','C','Tiger Safari','2100');
INSERT INTO Details_of_hoilday VALUES ('H6','China','11','B','China Highlights','1201');
INSERT INTO Details_of_hoilday VALUES ('H7','China','21','C','Great Wall Walk','2108');
INSERT INTO Details_of_hoilday VALUES ('H8','Spain','8','A','Andalusian Towns','647');
INSERT INTO Details_of_hoilday VALUES ('H9','Spain','15','B','Andalusian Walks','851');
COMMIT;

thanks

jessica
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-12-12 : 09:29:48
[code]SELECT Code_of_holidays, Total_cost * 1.0 / Duration
FROM Details_of_holiday[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-12 : 09:31:11

Also you should post your Oracle questions at www.orafaq.com as this forum is specific to MS SQL Server

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Jeskit@hotmail.co.uk
Starting Member

20 Posts

Posted - 2007-12-12 : 09:34:30
Hi

thanks you so much, your a life saver

thanks

jessica
Go to Top of Page
   

- Advertisement -