Oracle Apps Modules

Viewing and Exploring HR Schema Objects in Oracle 12c

Viewing and Exploring HR Schema Objects in Oracle 12c

In previous tutorial you have gone through following tutorials:

Installation of Oracle 12c

How to unlock HR Schema in Oracle database 12c

Creating Connection to Oracle 12c from SQL Developer

Connecting to HR schema from SQL Developer in Oracle 12c database

In this tutorial you will get to learn more about HR schema and its objects in Oracle 12c.

Listing the tables in HR schema


Run below command to see the tables in HR schema.

SELECT DISTINCT OBJECT_NAME
FROM USER_OBJECTS
WHERE OBJECT_TYPE = 'TABLE';

Output:

LOCATIONS
EMPLOYEES
REGIONS
JOBS
COUNTRIES
JOB_HISTORY
DEPARTMENTS

Viewing and Exploring HR Schema Objects

Listing all database Objects of HR schema in Oracle 12c


Below query will list all the database objects available HR schema.

SELECT OBJECT_NAME, OBJECT_TYPE 
FROM USER_OBJECTS
ORDER BY OBJECT_TYPE, OBJECT_NAME;

Viewing and Exploring HR Schema Objects

Viewing EMPLOYEES Table properties in SQL Developer


Below query will be used to describe the structure of Employees table.

DESCRIBE EMPLOYEES;

Viewing and Exploring HR Schema Objects

In same way you can see other Table properties also.

Selecting data from EMPLOYEES Table in SQL Developer


Below query will retrieve First Name, Phone Number and Salary from the Employees table and order it First Name.

SELECT FIRST_NAME, PHONE_NUMBER, SALARY
FROM EMPLOYEES
ORDER BY FIRST_NAME;

Same way you can select data for other tables.





Counting Total number of records from a Table


Use following query to count the number of rows in a table.

SQL> select count(*) from DEPARTMENTS;

Viewing and Exploring HR Schema Objects

In the same way you can count the number of rows in other Tables.

In next Tutorial you will learn more about Select queries in Oracle 12c.

 

Leave a Reply