Sunday, 3 August 2014

CONNECTING TO THE HR SCHEMA

    In this section, you connect to Oracle Database by using the SQL*Plus utility, and you unlock the HR schema.
    Open a terminal window and execute the oraenv command to set the environment variables.
    . oraenv
    Execute the following statement to connect to the database as a system administrator:
    sqlplus sys/<password> as sysdba;
    By default, the HR schema is locked. Execute the following statement to unlock the HR schema.
    ALTER USER hr IDENTIFIED BY hr ACCOUNT UNLOCK;
    Execute the following command to connect to the HR schema:
    CONNECT hr/hr;
    The DESCRIBE command provides a description of a specified table or view. The description for tables and views contains the following information:
    • Column names
    • Whether null values are allowed (NULL or NOT NULL) for each column
    • Data type of columns, such as DATENUMBERVARCHAR2 
    • Precision of columns, such as VARCHAR2(50)
    Syntax: DESC[RIBE] <table>
    Execute the following command to view the description of the EMPLOYEES table:
    DESCRIBE EMPLOYEES;