Summary: in this tutorial, you will learn about a SQL Sample Database called HR that manages the HR data of the small businesses.
The following database diagram illustrates the HR sample database:
The HR sample database has seven tables:
The following picture shows the table names and their records.
Table | Rows |
---|---|
employees | 40 |
dependents | 30 |
departments | 11 |
jobs | 11 |
locations | 7 |
countries | 25 |
regions | 4 |
Typically, you need to install a Relational Database Management System (RDBMS) to work with SQL.
If you have worked with an RDBMS such as MySQL, PostgreSQL, Oracle Database, and SQL Server, you can use the following script to create the sample database in one of these databases.
In case you don’t have a database system to practice, you can quickly use our SQL online tool to execute the SQL statements in your web browser.
The following SQL script creates the HR sample database in MySQL:
The following script allows you to insert data into the tables in MySQL:
The following script creates the HR sample database structure in PostgreSQL.
The following script allows you to insert data into the tables in PostgreSQL:
The following script creates the HR sample database structure in Microsoft SQL Server.
The following script allows you to insert data into the tables:
The following script creates the HR sample database structure in Oracle Database 12c.
The following script inserts data into the tables in the Oracle database:
The following script creates the HR sample database structure in SQLite.
The following script inserts data into the tables in the SQLite:
The following is the script that drops all tables in case you want to refresh the sample database.