jess Posted December 15, 2007 Share Posted December 15, 2007 hican anyone help me create a group by query which shows how manycode of holidays are provided at each holiday code. i'm really having trouble with this. can anyone help.thanksjessicap.s. if it helps i have inserted the table information.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; Link to comment Share on other sites More sharing options...
justsomeguy Posted December 17, 2007 Share Posted December 17, 2007 SELECT Code_of_hoildays, COUNT(DISTINCT(Hoilday_code)) FROM Details_of_hoilday GROUP BY Code_of_hoildays Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.