Build a MySQL Database Migration for a Library System
In this codelab, you'll create the database structure for a simple Student–Book Borrowing System using MySQL or MariaDB. By the end, you will have:
- a
studentstable for student records - a
bookstable for book records - a
borrowtable that connects students and books - sample data you can use while developing the PHP application
- a few SQL queries for testing borrowing and return status
What you'll learn: how to organize SQL into a migration file, create related tables with foreign keys, add seed data, and verify that the relationships work correctly.Before you begin You should have: MySQL or MariaDB installed and running Access to phpMyAdmin, the MySQL command line, or another database client An existing PHP project, if you plan to connect this database to a PHP application You do not need a migration framework such as Laravel for this exercise. We will create the migration using a plain
.sql file.
Sign in to save your progress permanently.
Progress is saved in your browser session
Step 1 of 19