Sample database description v15
The examples in the documentation use the sample tables dept
, emp
, and jobhist
, which are created and loaded when EDB Postgres Advanced Server is installed.
Available scripts
You can re-create the tables and programs in the sample database at any time by executing the following script:
Where <xx>
is the EDB Postgres Advanced Server version number.
In addition, a script in the same directory contains the database objects created using syntax compatible with Oracle databases. This script file is edb-sample.sql
. The script:
- Creates the sample tables and programs in the currently connected database.
- Grants all permissions on the tables to the
PUBLIC
group.
The tables and programs are created in the first schema of the search path in which the current user has permission to create tables and procedures. You can display the search path using the command:
You can use PSQL (a terminal-based interface for PostgreSQL) commands to modify the search path.
About the sample database
The sample database represents employees in an organization. It contains three types of records: employees, departments, and historical records of employees.
Each employee has an identification number, name, hire date, salary, and manager. Some employees earn a commission in addition to their salary. All employee-related information is stored in the emp
table.
The sample company is regionally diverse, so it tracks the locations of its departments. Each company employee is assigned to a department. Each department is identified by a unique department number and a short name. Each department is associated with one location. All department-related information is stored in the dept
table.
The company also tracks information about jobs held by the employees. Some employees have been with the company for a long time and have held different positions, received raises, switched departments, and so on. When a change in employee status occurs, the company records the end date of the former position. A new job record is added with the start date and the new job title, department, salary, and the reason for the status change. All employee history is maintained in the jobhist
table.
The following is the pg-sample.sql
script: