-
-
Save pamelafox/c705b02114ea3db0dff0 to your computer and use it in GitHub Desktop.
| /* Source: http://www.boxofficemojo.com/alltime/world/ */ | |
| CREATE TABLE top_movies( | |
| rank TEXT NOT NULL PRIMARY KEY | |
| , title TEXT | |
| , studio TEXT | |
| , worldwide TEXT | |
| , domestic_money TEXT | |
| , domestic_percent TEXT | |
| , overseas_money TEXT | |
| , overseas_percent TEXT | |
| , year TEXT | |
| ); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('Rank','Title','Studio','Worldwide','Domestic / %','Overseas / %','Year^','',''); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('1','Avatar','Fox','$2,788.0','$760.5','27.3%','$2,027.5','72.7%','2009^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('2','Titanic','Par.','$2,186.8','$658.7','30.1%','$1,528.1','69.9%','1997^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('3','Marvel''s The Avengers','BV','$1,518.6','$623.4','41.0%','$895.2','59.0%','2012'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('4','Harry Potter and the Deathly Hallows Part 2','WB','$1,341.5','$381.0','28.4%','$960.5','71.6%','2011'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('5','Furious 7','Uni.','$1,322.2','$321.2','24.3%','$1,001.0','75.7%','2015'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('6','Frozen','BV','$1,274.2','$400.7','31.4%','$873.5','68.6%','2013'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('7','Iron Man 3','BV','$1,215.4','$409.0','33.7%','$806.4','66.3%','2013'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('8','Transformers: Dark of the Moon','P/DW','$1,123.8','$352.4','31.4%','$771.4','68.6%','2011'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('9','The Lord of the Rings: The Return of the King','NL','$1,119.9','$377.8','33.7%','$742.1','66.3%','2003^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('10','Skyfall','Sony','$1,108.6','$304.4','27.5%','$804.2','72.5%','2012'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('11','Transformers: Age of Extinction','Par.','$1,091.4','$245.4','22.5%','$846.0','77.5%','2014'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('12','The Dark Knight Rises','WB','$1,084.4','$448.1','41.3%','$636.3','58.7%','2012'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('13','Pirates of the Caribbean: Dead Man''s Chest','BV','$1,066.2','$423.3','39.7%','$642.9','60.3%','2006'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('14','Toy Story 3','BV','$1,063.2','$415.0','39.0%','$648.2','61.0%','2010'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('15','Pirates of the Caribbean: On Stranger Tides','BV','$1,045.7','$241.1','23.1%','$804.6','76.9%','2011'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('16','Jurassic Park','Uni.','$1,029.2','$402.5','39.1%','$626.7','60.9%','1993^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('17','Star Wars: Episode I - The Phantom Menace','Fox','$1,027.0','$474.5','46.2%','$552.5','53.8%','1999^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('18','Alice in Wonderland (2010)','BV','$1,025.5','$334.2','32.6%','$691.3','67.4%','2010'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('19','The Hobbit: An Unexpected Journey','WB','$1,017.0','$303.0','29.8%','$714.0','70.2%','2012'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('20','The Dark Knight','WB','$1,004.6','$534.9','53.2%','$469.7','46.8%','2008^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('21','The Lion King','BV','$987.5','$422.8','42.8%','$564.7','57.2%','1994^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('22','Harry Potter and the Sorcerer''s Stone','WB','$974.8','$317.6','32.6%','$657.2','67.4%','2001'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('23','Despicable Me 2','Uni.','$970.8','$368.1','37.9%','$602.7','62.1%','2013'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('24','Pirates of the Caribbean: At World''s End','BV','$963.4','$309.4','32.1%','$654.0','67.9%','2007'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('25','The Hobbit: The Desolation of Smaug','WB','$960.4','$258.4','26.9%','$702.0','73.1%','2013'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('26','Harry Potter and the Deathly Hallows Part 1','WB','$960.3','$296.0','30.8%','$664.3','69.2%','2010'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('27','The Hobbit: The Battle of the Five Armies','WB','$955.1','$255.1','26.7%','$700.0','73.3%','2014'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('28','Harry Potter and the Order of the Phoenix','WB','$939.9','$292.0','31.1%','$647.9','68.9%','2007'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('29','Finding Nemo','BV','$936.7','$380.8','40.7%','$555.9','59.3%','2003^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('30','Harry Potter and the Half-Blood Prince','WB','$934.4','$302.0','32.3%','$632.5','67.7%','2009'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('31','The Lord of the Rings: The Two Towers','NL','$926.0','$342.6','37.0%','$583.5','63.0%','2002^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('32','Shrek 2','DW','$919.8','$441.2','48.0%','$478.6','52.0%','2004'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('33','Harry Potter and the Goblet of Fire','WB','$896.9','$290.0','32.3%','$606.9','67.7%','2005'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('34','Spider-Man 3','Sony','$890.9','$336.5','37.8%','$554.3','62.2%','2007'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('35','Ice Age: Dawn of the Dinosaurs','Fox','$886.7','$196.6','22.2%','$690.1','77.8%','2009'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('36','Harry Potter and the Chamber of Secrets','WB','$879.0','$262.0','29.8%','$617.0','70.2%','2002'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('37','Ice Age: Continental Drift','Fox','$877.2','$161.3','18.4%','$715.9','81.6%','2012'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('38','The Lord of the Rings: The Fellowship of the Ring','NL','$871.5','$315.5','36.2%','$556.0','63.8%','2001^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('39','The Hunger Games: Catching Fire','LGF','$864.9','$424.7','49.1%','$440.2','50.9%','2013'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('40','Star Wars: Episode III - Revenge of the Sith','Fox','$848.8','$380.3','44.8%','$468.5','55.2%','2005^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('41','Transformers: Revenge of the Fallen','P/DW','$836.3','$402.1','48.1%','$434.2','51.9%','2009'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('42','The Twilight Saga: Breaking Dawn Part 2','LG/S','$829.7','$292.3','35.2%','$537.4','64.8%','2012'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('43','Inception','WB','$825.5','$292.6','35.4%','$533.0','64.6%','2010'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('44','Spider-Man','Sony','$821.7','$403.7','49.1%','$418.0','50.9%','2002'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('45','Independence Day','Fox','$817.4','$306.2','37.5%','$511.2','62.5%','1996^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('46','Shrek the Third','P/DW','$799.0','$322.7','40.4%','$476.2','59.6%','2007'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('47','Harry Potter and the Prisoner of Azkaban','WB','$796.7','$249.5','31.3%','$547.1','68.7%','2004'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('48','E.T.: The Extra-Terrestrial','Uni.','$792.9','$435.1','54.9%','$357.8','45.1%','1982^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('49','Fast & Furious 6','Uni.','$788.7','$238.7','30.3%','$550.0','69.7%','2013'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('50','Indiana Jones and the Kingdom of the Crystal Skull','Par.','$786.6','$317.1','40.3%','$469.5','59.7%','2008'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('51','Spider-Man 2','Sony','$783.8','$373.6','47.7%','$410.2','52.3%','2004'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('52','Star Wars','Fox','$775.4','$461.0','59.5%','$314.4','40.5%','1977^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('53','Guardians of the Galaxy','BV','$774.2','$333.2','43.0%','$441.0','57.0%','2014'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('54','2012','Sony','$769.7','$166.1','21.6%','$603.6','78.4%','2009'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('55','Maleficent','BV','$758.4','$241.4','31.8%','$517.0','68.2%','2014'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('56','The Da Vinci Code','Sony','$758.2','$217.5','28.7%','$540.7','71.3%','2006'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('57','The Amazing Spider-Man','Sony','$757.9','$262.0','34.6%','$495.9','65.4%','2012'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('58','Shrek Forever After','P/DW','$752.6','$238.7','31.7%','$513.9','68.3%','2010'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('59','The Hunger Games: Mockingjay - Part 1','LGF','$752.1','$337.1','44.8%','$415.0','55.2%','2014'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('60','X-Men: Days of Future Past','Fox','$748.1','$233.9','31.3%','$514.2','68.7%','2014'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('61','Madagascar 3: Europe''s Most Wanted','P/DW','$746.9','$216.4','29.0%','$530.5','71.0%','2012'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('62','The Chronicles of Narnia: The Lion, the Witch and the Wardrobe','BV','$745.0','$291.7','39.2%','$453.3','60.8%','2005'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('63','Monsters University','BV','$743.6','$268.5','36.1%','$475.1','63.9%','2013'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('64','The Matrix Reloaded','WB','$742.1','$281.6','37.9%','$460.6','62.1%','2003'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('65','Up','BV','$731.3','$293.0','40.1%','$438.3','59.9%','2009'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('66','Gravity','WB','$716.4','$274.1','38.3%','$442.3','61.7%','2013'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('67','Captain America: The Winter Soldier','BV','$714.8','$259.8','36.3%','$455.0','63.7%','2014'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('68','The Twilight Saga: Breaking Dawn Part 1','Sum.','$712.2','$281.3','39.5%','$430.9','60.5%','2011'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('69','The Twilight Saga: New Moon','Sum.','$709.8','$296.6','41.8%','$413.2','58.2%','2009'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('70','Transformers','P/DW','$709.7','$319.2','45.0%','$390.5','55.0%','2007'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('71','The Amazing Spider-Man 2','Sony','$709.0','$202.9','28.6%','$506.1','71.4%','2014'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('72','Dawn of the Planet of the Apes','Fox','$708.8','$208.5','29.4%','$500.3','70.6%','2014'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('73','The Twilight Saga: Eclipse','Sum.','$698.5','$300.5','43.0%','$398.0','57.0%','2010'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('74','Mission: Impossible - Ghost Protocol','Par.','$694.7','$209.4','30.1%','$485.3','69.9%','2011'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('75','The Hunger Games','LGF','$691.2','$408.0','59.0%','$283.2','41.0%','2012'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('76','Forrest Gump','Par.','$677.9','$330.3','48.7%','$347.7','51.3%','1994^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('77','The Sixth Sense','BV','$672.8','$293.5','43.6%','$379.3','56.4%','1999'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('78','Interstellar','Par.','$672.7','$188.0','27.9%','$484.7','72.1%','2014'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('79','Man of Steel','WB','$668.0','$291.0','43.6%','$377.0','56.4%','2013'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('80','Kung Fu Panda 2','P/DW','$665.7','$165.2','24.8%','$500.4','75.2%','2011'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('81','Ice Age: The Meltdown','Fox','$660.9','$195.3','29.6%','$465.6','70.4%','2006'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('82','Pirates of the Caribbean: The Curse of the Black Pearl','BV','$654.3','$305.4','46.7%','$348.9','53.3%','2003'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('83','Big Hero 6','BV','$652.0','$222.4','34.1%','$429.6','65.9%','2014'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('84','Star Wars: Episode II - Attack of the Clones','Fox','$649.4','$310.7','47.8%','$338.7','52.2%','2002^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('85','Thor: The Dark World','BV','$644.8','$206.4','32.0%','$438.4','68.0%','2013'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('86','Kung Fu Panda','P/DW','$631.7','$215.4','34.1%','$416.3','65.9%','2008'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('87','The Incredibles','BV','$631.4','$261.4','41.4%','$370.0','58.6%','2004'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('88','Fast Five','Uni.','$626.1','$209.8','33.5%','$416.3','66.5%','2011'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('89','Hancock','Sony','$624.4','$227.9','36.5%','$396.4','63.5%','2008'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('90','MIB 3','Sony','$624.0','$179.0','28.7%','$445.0','71.3%','2012'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('91','Iron Man 2','Par.','$623.9','$312.4','50.1%','$311.5','49.9%','2010'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('92','Ratatouille','BV','$623.7','$206.4','33.1%','$417.3','66.9%','2007'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('93','How to Train Your Dragon 2','Fox','$618.9','$177.0','28.6%','$441.9','71.4%','2014'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('94','The Lost World: Jurassic Park','Uni.','$618.6','$229.1','37.0%','$389.6','63.0%','1997'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('95','The Passion of the Christ','NM','$611.9','$370.8','60.6%','$241.1','39.4%','2004^'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('96','Mamma Mia!','Uni.','$609.8','$144.1','23.6%','$465.7','76.4%','2008'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('97','Life of Pi','Fox','$609.0','$125.0','20.5%','$484.0','79.5%','2012'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('98','Madagascar: Escape 2 Africa','P/DW','$603.9','$180.0','29.8%','$423.9','70.2%','2008'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('99','Casino Royale','Sony','$599.0','$167.4','28.0%','$431.6','72.0%','2006'); | |
| INSERT INTO top_movies(rank,title,studio,worldwide,domestic_money,domestic_percent,overseas_money,overseas_percent,year) VALUES ('100','Tangled','BV','$591.8','$200.8','33.9%','$391.0','66.1%','2010'); | |
| SELECT * FROM top_movies; |
petercollingridge
you mean that?:
SELECT AVG(CAST(SUBSTR(domestic_money, 2) AS REAL)) AS AVG_MONEY FROM top_movies;
AVG(domestic_money) doesn't work because of the $ in front. The fact that the data type is TEXT won't cause an error--look at AVG(year)--that works just fine.
That being said, AVG(SUBSTR(DOMESTIC_MONEY,2)) is all you need.
Even if a workaround works for the exercise, I don't want to encourage my new hires to learn that an optimistic substr is OK in a production system.
I find that the worldwide figure data for Avatar, Titanic and Furious 7 has some problems. The integer I get is always 2 for Avatar, please help.
Used Replace function to replace the comma, the substring function to start from the second position to omit the $ sign, and finally the convert function to convert to decimal data type.
select convert(substring(replace(worldwide,',',''),2),decimal(6,2)) as worldwide_gross from top_movies;
I noticed some carrots at the end of some of the year cells. What do those mean?
@abatt0ir: The source (http://www.boxofficemojo.com/alltime/world/) has notes that go with the chart. One of them explains the carot:
"^ Indicates the movie made its gross over multiple releases."
This is a really good example of data cleansing requirements for my students though they'd have almost no chance of understanding how to do this from the course content covered so far.
In order to return an average worldwide gross value figure (assuming in millions of $US) from the dataset provided that is correct as per data on 7Feb16 ($862.84) and formatted with a dollar sign at the front, you'd need to do the following.
SELECT '$' || ROUND(AVG(CAST(SUBSTR(REPLACE(worldwide,',',''),2) AS REAL)),2) AS AVG_WorldWide_Gross_in_Million_USD FROM top_movies WHERE CAST(SUBSTR(REPLACE(worldwide,',',''),2) AS REAL) != 0;
Thanks to all who have provided feedback in the comments above.
Is it better practice to just Find and replace in notepad all the $ or use the cast and all that ?
Why the first raw duplicates column names? Also it looks that starting with domestic_percent it doesn't match.
I was trying on khan academy to use this data for the SQL "Data dig" project but ran into a weird result after running this sql statement:
/* show how much money the Pirates series made */
select "All Pirates Series", SUM(CAST(replace(trim(worldwide,'$'),',','') as REAL))
as "$ Total WorldWide" from top_movies where title like 'Pirates%';
Instead of the expected value of 3729.6, the select returned 3729.6000000000003 . I cannot even guess why at this point. I tried using FLOA type as well in case it makes any diff. I even tried an extra trim around the replace statement in case there were extra spaces messing things up. What am I missing? (thanks in advance)
In order to play around with this data set on Khan Academy, use the following style of code rather than simply using the provided column name:
CAST(REPLACE(SUBSTR(worldwide,2),',','')AS real)
-
Here I have taken the column 'worldwide' and started considering the values only from the second position using SUBSTR so that dollar signs are ignored.
-
Then I have used REPLACE to basically replace the commas with blanks.
-
Finally I have changed datatype from string to real using CAST.
Hope this helps!
Why is it not possible for me to use TOP keyword in the editor? I have found the keyword LIMIT to be working but TOP gives a syntax error :(
Since within the raw data, there are some years that end up with '^', which will cause duplicate value when remove the '^' by SUBSTR, here comes my question, if want to make a query to select those years that total yearly worldwide gross higher than some numbers such as 1000, how to do it. my solution seems can't remove the duplicated year.
SELECT DISTINCT REPLACE(year,'^','') AS Year, ROUND(SUM(REPLACE(SUBSTR(worldwide,2),',',''))) AS sum_world_gross FROM top_movies WHERE worldwide !='Worldwide' GROUP BY Year HAVING ROUND(SUM(REPLACE(SUBSTR(worldwide,2),',',''))) > 1000;
The result is weird, for example, there are 2 2008 with different sum_world_gross
In order to play around with this data set on Khan Academy, use the following style of code rather than simply using the provided column name:
CAST(REPLACE(SUBSTR(worldwide,2),',','')AS real)
- Here I have taken the column 'worldwide' and started considering the values only from the second position using SUBSTR so that dollar signs are ignored.
- Then I have used REPLACE to basically replace the commas with blanks.
- Finally I have changed datatype from string to real using CAST.
Hope this helps!
It did. Thanks. A shame this wasn't included in the actual course (so far anyway).
What's this CAST(REPLACE(SUBSTR())) about? Is this even covered in the tutorial? where do I put this.
Hi,
Is there some reason why all variables are "TEXT", when there was possibility of INTEGER or DECIMAL?
Thank you
Hi,
i have same problem but i find new solution:
SELECT * FROM top_movies;
SELECT studio, AVG(worldwide) as avg_worldwide FROM top_movies group by studio ;/*(bad response)*/
SELECT studio, AVG(replace(worldwide,'$','')) as avg_worldwide FROM top_movies group by studio ;/*(bad response, i check in excel: avg all valueBV=871,1)*/
SELECT studio, AVG(substr(worldwide, 2 , 10)) as avg_worldwide FROM top_movies group by studio;/*(bad response)*/
SELECT studio, AVG(substr(worldwide, 2 , 10)) as avg_worldwide FROM top_movies group by studio,worldwide;/*(i try group by studio and worldwide and i found inaccuracy of values from response)*/
UPDATE top_movies SET worldwide = replace(worldwide,',','');
UPDATE top_movies SET worldwide = replace(worldwide,'$','');
SELECT studio, AVG(worldwide) as avg_worldwide FROM top_movies group by studio ;/*heureka it's good response*/
Hope this helps!
Hi,
What I did was to copy all the data in a txt and replace all the ´$´ with ´´ and then used that info.
I love Khan Academy but they have a tendency to challenge you with tests that require advanced methods they don't teach; offering this table as an option for one of their projects really takes the cake. Also, none of the suggestions in this thread work for said project.
@aaronhhelton Thanks for the feedback! You're right, this dataset has a lot of value that needs cleaning. I'll look for a new data set that's more appropriate for the project level.
(And sorry I missed so much conversation on this gist - y'all came up with some great approaches to cleaning it)
Here are some additional data sets for the project:
Pokemon - https://gist.github.com/pamelafox/26b9357c6120d3d0d27c2b90c950e8c6
Superbowls - https://gist.github.com/pamelafox/3d8ab901def3577a8bfc881f6255d3f6
NBA players of the week - https://gist.github.com/pamelafox/6cda1115e2bcbc43e62cf4ff9d4158c7
NASA astronauts - https://gist.github.com/pamelafox/b98e03caca7d1ec14394a90ec1512cff
I have also updated this gist with cleaned numeric data.
Cool!
Good! It works fine.
alguien que hable español
I've seen a few people have problems with this data set when trying, for example, to find the average worldwide takings, since the values are text. I don't know much SQL, so don't know if there is a good solution for this. There seems to be a MONEY type, but I don't think it's implemented on KA (?).