Sunday, 3 August 2014

Understanding the HR Sample Schema



    A database schema is a collection of metadata that describes the relationship between the data in a database. A schema can be simply described as the "layout" of a database or the blueprint that outlines how data is organized into tables.

    Schema objects are database objects that contain data or that govern or perform operations on data. By definition, each schema object belongs to a specific schema. The following are commonly used schema objects:
    • Tables: Basic units of data storage in an Oracle database. Here, data is stored in rows and columns. You define a table with a table name and a set of columns. 
    • Indexes: Performance-tuning methods for allowing faster retrieval of records.
    • Views: Representations of SQL statements that are stored in memory so that they can be reused. 
    The Human Resources (HR) schema is part of the Oracle Sample Schemas that you can install with Oracle Database. The following is the entity-relationship diagram of the HR schema:


    The schema contains the following tables:
    • The REGIONS table contains rows that represent a region such as the Americas or Asia.
    • The COUNTRIES table contains rows for countries, each of which is associated with a region.
    • The LOCATIONS table contains the specific addresses for the offices, warehouses, or production sites of a company in a particular country.
    • The DEPARTMENTS table contains details about the departments in which employees work. Each department may have a relationship representing the department manager in the EMPLOYEES table.
    • The EMPLOYEES table contains details about each employee who works in a department. Some employees may not be assigned to a department.
    • The JOBS table contains the job types that an employee can hold.
    • The JOB_HISTORY table contains an employee's job history.