This project is a Movie Ratings Database built using Python and SQLite. The purpose of this program is to gain hands-on experience integrating software with a relational database. As a software engineer, my goal with this project was to understand how to store, retrieve, and manipulate structured data efficiently using SQL commands inside a Python program.
The software creates a SQLite database containing users, movies, and ratings. It allows for inserting, updating, deleting, and querying data in a simple and transparent way. After running the program, the database is automatically built, populated with sample data, and queried to display results directly in the console. The program also calculates the average movie ratings using an SQL aggregate function.
Purpose:
This project helps strengthen my understanding of how back-end systems connect to relational databases and how SQL commands can be executed dynamically from within a Python script. The experience gained here provides a foundation for future projects that require persistent data storage such as inventory systems, media libraries, or user-based applications.
The database used in this project is SQLite, a lightweight and file-based relational database engine. It is ideal for small to medium applications and is integrated directly into Python via the sqlite3 library.
The program creates three tables that are related through foreign keys:
-
Users
user_id(Primary Key)usernameemail
-
Movies
movie_id(Primary Key)titlerelease_yeargenre
-
Ratings
rating_id(Primary Key)user_id(Foreign Key → Users)movie_id(Foreign Key → Movies)rating
The Ratings table links users to the movies they have rated. The program demonstrates the ability to perform JOIN operations between these tables and uses the AVG() aggregate function to compute the average rating for each movie.
- Tools Used: Visual Studio Code, SQLite
- Programming Language: Python
- Libraries:
sqlite3(built-in Python library for working with SQLite databases)
The program was developed and tested in a Windows environment using Python’s command-line interface to execute and verify database operations.
- SQLite3 Python Tutorial in 5 Minutes
- W3Schools SQL Tutorial
- SQLite Tutorial
- Python SQLite Documentation
- ChatGPT
- Add a timestamp column to the Ratings table to track when ratings are submitted.
- Create a user input interface that allows adding new users, movies, and ratings dynamically.
- Implement filtering and sorting (e.g., show top-rated or most recent movies).