PHP - Popular Titles
► Problem Description: For this problem, we'll first want to create a table showing how many titles there were for each decade. It'll look something like this:
Decade Count ------ ----- 2000 6947 1990 5173 ... 1890 1
Then for each decade: 1940s, 1950s, 1960s, 1970s, 1980s, 1990s and 2000s, find the ten highest rated titles for that decade. We generally want to see movies (not television shows) so weed out any titles containing any of these strings:
Season Seasons Series Vol. Vols.
Output a table for each decade, label it: "Top xyz Movies" where 'xyz' is the decade in question. Show the rating, number of ratings and title for each of the top ten titles.
Here's what the output will look like for the 1960s, for example
Top 1960s Movies Rating Number Of Ratings Title ------ ----------------- ------ 4.29 64555 To Kill a Mockingbird 4.16 33056 The Great Escape 4.15 55444 Mary Poppins 4.14 42100 Cool Hand Luke ...
► Example Output: Here's what the output should look like.
Total Titles Per Decade
Decade | Count |
2000 | 6947 |
1990 | 5173 |
1980 | 2136 |
1970 | 1309 |
1960 | 952 |
1950 | 561 |
1940 | 359 |
1930 | 219 |
1920 | 81 |
1910 | 24 |
1900 | 1 |
1890 | 1 |
Top 1930s Movies
Rating | Number Of Ratings | Title |
4.17 | 74829 | The Wizard of Oz: Collector's Edition |
4.13 | 54347 | Gone with the Wind: Collector's Edition |
4.07 | 5050 | A Night at the Opera |
4.07 | 4500 | City Lights |
4.06 | 9432 | Bringing Up Baby |
4.03 | 11095 | The Thin Man |
4.02 | 4900 | Animal Crackers |
4.01 | 2947 | Imitation of Life: Double Feature (1934, 1959) |
4.01 | 3893 | Grand Illusion |
4.01 | 17123 | It Happened One Night |
Top 1940s Movies
Rating | Number Of Ratings | Title |
4.17 | 21838 | It's a Wonderful Life |
4.09 | 23103 | Bambi: Platinum Edition |
4.06 | 23973 | The Philadelphia Story |
4.05 | 12832 | The Big Sleep |
4.04 | 5236 | Laura |
4.04 | 6819 | To Have and Have Not |
4.03 | 32866 | The Maltese Falcon |
4.02 | 61758 | Citizen Kane |
4.01 | 13709 | The Treasure of the Sierra Madre |
4.01 | 16723 | Notorious |
Top 1950s Movies
Rating | Number Of Ratings | Title |
4.39 | 7919 | Cinderella: Special Edition |
4.24 | 57941 | Rear Window |
4.20 | 31691 | Seven Samurai |
4.18 | 3480 | Taxi Driver |
4.17 | 35109 | 12 Angry Men |
4.16 | 43122 | North by Northwest |
4.15 | 11436 | Moulin Rouge |
4.12 | 38778 | The Bridge on the River Kwai |
4.10 | 16470 | Dial M for Murder |
4.10 | 29225 | Singin' in the Rain |
Top 1960s Movies
Rating | Number Of Ratings | Title |
4.29 | 64555 | To Kill a Mockingbird |
4.16 | 33056 | The Great Escape |
4.15 | 55444 | Mary Poppins |
4.14 | 42100 | Cool Hand Luke |
4.12 | 57954 | Dr. Strangelove |
4.12 | 38613 | Lawrence of Arabia |
4.12 | 5945 | The Battle of Algiers |
4.12 | 45963 | Butch Cassidy and the Sundance Kid |
4.10 | 6130 | Charade |
4.10 | 2453 | More Treasures of the Twilight Zone |
Top 1970s Movies
Rating | Number Of Ratings | Title |
4.50 | 106327 | The Godfather |
4.50 | 85184 | Star Wars: Episode IV: A New Hope |
4.40 | 71614 | The Godfather, Part II |
4.28 | 87056 | One Flew Over the Cuckoo's Nest |
4.17 | 84651 | Monty Python and the Holy Grail |
4.16 | 38514 | The Sting |
4.14 | 41128 | Apocalypse Now Redux |
4.11 | 48496 | Alien: Collector's Edition |
4.08 | 8876 | Fawlty Towers: The Complete Set |
4.08 | 31743 | Gone in 60 Seconds |
Top 1980s Movies
Rating | Number Of Ratings | Title |
4.54 | 92470 | Star Wars: Episode V: The Empire Strikes Back |
4.50 | 118212 | Raiders of the Lost Ark |
4.46 | 88846 | Star Wars: Episode VI: Return of the Jedi |
4.40 | 8056 | Anne of Green Gables |
4.33 | 144320 | Indiana Jones and the Last Crusade |
4.30 | 88687 | The Princess Bride |
4.29 | 7224 | The Blues Brothers: Extended Cut |
4.24 | 5197 | My Neighbor Totoro |
4.21 | 19244 | Cinema Paradiso: Director's Cut |
4.19 | 6674 | Nausicaa of the Valley of the Wind |
Top 1990s Movies
Rating | Number Of Ratings | Title |
4.59 | 139660 | The Shawshank Redemption: Special Edition |
4.46 | 101141 | Schindler's List |
4.39 | 15469 | The Simpsons: Treehouse of Horror |
4.37 | 108343 | The Usual Suspects |
4.36 | 5902 | Ken Burns' Civil War |
4.35 | 51306 | Toy Story |
4.34 | 19885 | Pride and Prejudice |
4.33 | 151292 | The Sixth Sense |
4.32 | 2564 | My So-Called Life |
4.31 | 181426 | The Green Mile |
Top 2000s Movies
Rating | Number Of Ratings | Title |
4.72 | 73422 | The Lord of the Rings: The Fellowship of the Ring: Extended Edition |
4.72 | 73335 | Lord of the Rings: The Return of the King: Extended Edition |
4.70 | 74912 | Lord of the Rings: The Two Towers: Extended Edition |
4.55 | 134284 | Lord of the Rings: The Return of the King |
4.52 | 10027 | Family Guy: Freakin' Sweet Collection |
4.51 | 9599 | Gladiator: Extended Edition |
4.51 | 37514 | Band of Brothers |
4.47 | 2000 | Samurai Champloo |
4.46 | 151245 | Lord of the Rings: The Two Towers |
4.45 | 10772 | Firefly |
► Source Code