A hands-on learning lab to master JDBC and SQL querying skills using the Sakila sample database.
📌 SQL scripts are included for reference and should be executed in tools like DBeaver or MySQL Workbench — not from IntelliJ.
- Java 21 or higher
- Maven
- MySQL Server (8.x recommended)
- Sakila Sample Database (see below)
- TestNG (managed by Maven)
- Download the Sakila sample database from the official MySQL site.
- Import the Sakila schema and data into your MySQL instance using your preferred MySQL client (e.g., MySQL Workbench, DBeaver):
- Example command:
mysql -u root -p < sakila-schema.sql mysql -u root -p < sakila-data.sql
- Example command:
- Ensure the database is named
sakilaand accessible atlocalhost:3306.
Important: Database credentials are currently hardcoded in the Java source files (
root/.MySQL01,).For security and flexibility, you should update these credentials in the code or refactor to use environment variables or a configuration file. See
JDBCParent.javaandJDBCPractices01.javafor details.
- How to connect to MySQL databases using JDBC
- Execute SQL queries and navigate results with Java
- Use scrollable
ResultSetfeatures - Validate data with TestNG assertions
- Structure DB test flows professionally
- Java 21
- JDBC (MySQL Connector)
- TestNG 7.10+
- Maven
- MySQL (Sakila)
jdbc-mysql-practice-lessons/
├── src/
│ └── test/
│ └── java/
│ ├── jdbc/
│ │ ├── JDBCParent.java
│ │ ├── JDBCPractices01.java
│ │ ├── JDBCPractices02.java
│ │ ├── JDBCSakilaCustomerAddAndVerifyExample.java
│ │ └── JDBCSakilaTask.java
│ │
│ └── mysql-sakila-db-practice-notes/
│ ├── MySQL_SakilaDB_Mentoring_01.sql
│ ├── MySQL_SakilaDB_Mentoring_02.sql
│ └── MySQL_SakilaDB_Mentoring_03.sql
├── pom.xml
└── README.md
# Clone the repository
git clone https://github.com/cihat-kose/jdbc-mysql-sakila-db-practice-notes-practice-lessons.git
cd jdbc-mysql-sakila-db-practice-notes-practice-lessons
# Build the project
mvn clean install
# Run all tests
mvn testThe .sql scripts in this repo are for learning purposes only:
- Based on the Sakila sample DB
- Practice topics include:
- Filtering, sorting, joins
- Aggregation, grouping, DDL & DML
- Query navigation & performance
- Execute them in tools like MySQL Workbench, DBeaver, or DataGrip
This repo is a great fit if you're:
- A QA Engineer learning database testing
- A SDET student preparing for real-life test scenarios
- A Java developer exploring JDBC deeper
- A bootcamp attendee reviewing SQL basics
- Database credentials are hardcoded in the source code. Update them before running tests.
- Some code comments are in Turkish.
- Assumes a local MySQL instance with the Sakila database is running and accessible.
Contributions, issues, and feature requests are welcome! Please open an issue or submit a pull request on GitHub.
cihatkose
Creating dev tools and educational resources for future engineers.
This project is licensed under the MIT License.