Easily set up the official Oracle HR (Human Resources) sample schema in your Oracle database — perfect for learning, testing SQL queries, or demonstrating features.
This repo contains a set of SQL scripts designed to:
- Create the
HRuser and schema - Set up all required tables
- Populate the tables with sample data
- Add indexes and comments
- A running Oracle database (e.g., set it up using this guide)
- A SQL client like Oracle SQL Developer or VS Code with the Oracle SQL Developer Extension for VS Code
Follow these steps to create the HR sample schema in your Oracle pluggable database (PDB):
- Download the SQL files in this repository, using either the Git commands or manually downloading them (view file > raw > save as).
git clone https://github.com/adibbiniqbal/oracle-hr-sample-schema- Open an IDE (e.g. Oracle SQL Developer) and connect to your container database.
- Login as SYS AS SYSDBA and run script 01, which creates the new HR user and grants the necessary privileges.
- Connect to the database as the new HR user.
- Run script 02 to create the tables.
- Run script 03 to populate the tables with sample data.
- Run script 04 to create indexes and add comments.
The schema is now set up!
Username: HR
Password: hr
Host: localhost
Port: 1521
Service Name: orclpdb1
Here's the ERD of the HR schema used:

MIT License — feel free to use, modify, and contribute.
If you have questions, open an issue or submit a pull request!