Skip to content

CodeYouOrg/horror-movies-c9177d-f34623

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Horror Movies Exercise

Code Louisville Data Analysis Exercise

Overview

In this exercise we will write a sql query against a database of movies. This exercise is based on the Codecademy Learn SQL "Queries" module.

movies Table

column type constraint
id INTEGER PRIMARY KEY
name TEXT NOT NULL
genre TEXT
year INTEGER
imdb_rating REAL

Write a SQL query that returns the id, name and imdb rating of top 3 movies in the horror genre that were released in or before 1985. Note that the column names in the resulting file have been changed from "id", "name", and "imdb_rating" to "Movie_ID", "Movie_Title", and "Rating".

Example Output Data

Movie_ID Movie_Title Rating
226 The Shining 8.4
100 Gremlins 7.2
116 The Amityville Horror 6.2

You will write your query in the sql/horror_movies.sql file. Running the run_sql.py script will execute your query and save the results to data/movies.csv.

Instructions

  1. Clone the repo to your machine.
  2. Create a virtual environment and install the packages listed in the requirements.txt file (instructions below).
  3. Add your SQL query to the sql/horror_movies.sql file.
  4. Run the run_sql.py script. This script will execute your query against the database and save the results to data/movies.csv.
  5. Add, Commit, and Push your sql/horror_movies.sql and data/movies.csv files back to GitHub.

Virutal Environment Instructions

  1. After you have cloned the repo to your machine, navigate to the project folder in GitBash/Terminal.
  2. Create a virtual environment in the project folder. python3 -m venv venv 1
  3. Activate the virtual environment. source venv/bin/activate
  4. Install the required packages. pip install -r requirements.txt
  5. When you are done working on your repo, deactivate the virtual environment. deactivate

Automated Testing

This repo contains a small testing program that is automatically run by GitHub to validate your code. This testing program is contained in the tests.py file. You don't have to do anything with this file to complete the exercise, but you can follow these steps if you would like to run the tests on your machine.

  1. Open GitBash in Windows or the Terminal in Mac and navigate to the project folder.
  2. Activate the virtual environment if it is not already active.
  3. Use the following command to run the tests: pytest tests.py.
  4. Review the output from running the test. This will let you know whether your code produces the expected results.

Footnotes

  1. GitBash on Windows uses “python” instead of “python3”

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages