jess Posted December 12, 2007 Share Posted December 12, 2007 hi in my hoilday database, i need to write a query in sql that shows which shows which hoilday visits the most sites. i'm having alot of trouble with this can anyone help me?thanks jessicap.s. below is the table infor if it helpsCREATE TABLE Sites_visited_on_hoilday ( Code_of_hoildays VARCHAR2 (20), Code_of_the_sites NUMBER, FOREIGN KEY (Code_of_hoildays) REFERENCES Details_of_hoilday (Code_of_hoildays), FOREIGN KEY (Code_of_the_sites) REFERENCES Details_of_sites_visited (Code_of_the_sites) );INSERT INTO Sites_visited_on_hoilday VALUES ('H1','101');INSERT INTO Sites_visited_on_hoilday VALUES ('H1','111');INSERT INTO Sites_visited_on_hoilday VALUES ('H1','109');INSERT INTO Sites_visited_on_hoilday VALUES ('H1','105');INSERT INTO Sites_visited_on_hoilday VALUES ('H1','107');INSERT INTO Sites_visited_on_hoilday VALUES ('H2','104');INSERT INTO Sites_visited_on_hoilday VALUES ('H2','101');INSERT INTO Sites_visited_on_hoilday VALUES ('H2','105');INSERT INTO Sites_visited_on_hoilday VALUES ('H2','111');INSERT INTO Sites_visited_on_hoilday VALUES ('H2','107');INSERT INTO Sites_visited_on_hoilday VALUES ('H2','109');INSERT INTO Sites_visited_on_hoilday VALUES ('H3','108');INSERT INTO Sites_visited_on_hoilday VALUES ('H4','124');INSERT INTO Sites_visited_on_hoilday VALUES ('H4','106');INSERT INTO Sites_visited_on_hoilday VALUES ('H5','115');INSERT INTO Sites_visited_on_hoilday VALUES ('H5','113');INSERT INTO Sites_visited_on_hoilday VALUES ('H5','124');INSERT INTO Sites_visited_on_hoilday VALUES ('H6','116');INSERT INTO Sites_visited_on_hoilday VALUES ('H6','102');INSERT INTO Sites_visited_on_hoilday VALUES ('H6','112');INSERT INTO Sites_visited_on_hoilday VALUES ('H7','116');INSERT INTO Sites_visited_on_hoilday VALUES ('H7','117');INSERT INTO Sites_visited_on_hoilday VALUES ('H7','112');INSERT INTO Sites_visited_on_hoilday VALUES ('H7','123');INSERT INTO Sites_visited_on_hoilday VALUES ('H8','103');INSERT INTO Sites_visited_on_hoilday VALUES ('H8','120');INSERT INTO Sites_visited_on_hoilday VALUES ('H8','119');INSERT INTO Sites_visited_on_hoilday VALUES ('H9','122');INSERT INTO Sites_visited_on_hoilday VALUES ('H9','120');INSERT INTO Sites_visited_on_hoilday VALUES ('H9','103');INSERT INTO Sites_visited_on_hoilday VALUES ('H9','119');COMMIT; Link to comment Share on other sites More sharing options...
justsomeguy Posted December 12, 2007 Share Posted December 12, 2007 SELECT Code_of_hoildays, COUNT(Code_of_the_sites) FROM Sites_visited_on_hoilday GROUP BY Code_of_hoildaysAlso, someone should mention that it's spelled "holiday". As in it's a "holy day" where you don't work (I assume that's where the word came from). Wikipedia seems to think so. A contraction of holy and day, holidays originally represented special religious days. Link to comment Share on other sites More sharing options...
jess Posted December 12, 2007 Author Share Posted December 12, 2007 hiyes i do know that holiday is pelt wrong, i haven't had chance to change it yet.thank you very much the code worked perfectly, thanks your a life saverthanksjessica Link to comment Share on other sites More sharing options...
justsomeguy Posted December 12, 2007 Share Posted December 12, 2007 Cool, I wasn't sure if it was a regional thing or what, I know you folks in Gloster are fond of doing strange things to your words. Just like the folks over here in Wooster, MA. Also the folks in Louavul, KY, which obviously was named after King Loua XVI. And if someone else says "no, it's pronounced Missour-A" to me again they might get punched in the face.ahem, sorry. Anyway, happy to help. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.