Database Objects in DBMS
Database Objects in DBMS
A database object is any defined object in a database that is used to store or reference data.
Anything which we make from create command is known as Database Object. It can be used to
hold and manipulate the data. Some of the examples of database objects are : view, sequence,
indexes, etc.
Syntax :
Example :
2. View – This database object is used to create a view in database. A view is a logical table
based on a table or another view. A view contains no data of its own but is like a window
through which data from tables can be viewed or changed. The tables on which a view is based
are called base tables. The view is stored as a SELECT statement in the data dictionary.
Syntax :
Output :
3 Sequence – This database object is used to create a sequence in database. A sequence is a user
created database object that can be shared by multiple users to generate unique integers. A
typical usage for sequences is to create a primary key value, which must be unique for each
row.The sequence is generated and incremented (or decremented) by an internal Oracle routine.
Syntax :
Example :
An index provides direct and fast access to rows in a table. Its purpose is to reduce the necessity
of disk I/O by using an indexed path to locate data quickly. The index is used and maintained
automatically by the Oracle server. Once an index is created, no direct activity is required by the
user. Indexes are logically and physically independent of the table they index. This means that
they can be created or dropped at any time and have no effect on the base tables or other indexes.
Syntax :
Example :
5 Synonym – This database object is used to create a indexes in database. It simplify access to
objects by creating a synonym(another name for an object). With synonyms, you can Ease
referring to a table owned by another user and shorten lengthy object names. To refer to a table
owned by another user, you need to prefix the table name with the name of the user who created
it followed by a period. Creating a synonym eliminates the need to qualify the object name with
the schema and provides you with an alternative name for a table, view, sequence, procedure, or
other objects. This method can be especially useful with lengthy object names, such as views.
In the syntax:
PUBLIC : creates a synonym accessible to all users synonym : is the name of the synonym to be
created
object : identifies the object for which the synonym is created
Syntax :
Example :