Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Aptitude
  • Engineering Mathematics
  • Discrete Mathematics
  • Operating System
  • DBMS
  • Computer Networks
  • Digital Logic and Design
  • C Programming
  • Data Structures
  • Algorithms
  • Theory of Computation
  • Compiler Design
  • Computer Org and Architecture
Open In App
Next Article:
Database Objects in DBMS
Next article icon

Database Objects in DBMS

Last Updated : 20 Aug, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
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.
  • Table - Basic unit of storage; composed rows and columns
  • View - Logically represents subsets of data from one or more tables
  • Sequence - Generates primary key values
  • Index - Improves the performance of some queries
  • Synonym - Alternative name for an object
Different database Objects :
  1. Table - This database object is used to create a table in database. Syntax :
      CREATE TABLE [schema.]table                 (column datatype [DEFAULT expr][, ...]);
    Example :
      CREATE TABLE dept             (deptno NUMBER(2),              dname VARCHAR2(14),              loc VARCHAR2(13));
    Output :
    DESCRIBE dept;
    table output
  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 :
      CREATE [OR REPLACE] [FORCE|NOFORCE] VIEW view                         [(alias[, alias]...)]                         AS subquery                         [WITH CHECK OPTION [CONSTRAINT constraint]]                         [WITH READ ONLY [CONSTRAINT constraint]];
    Example :
    CREATE VIEW salvu50                 AS SELECT employee_id ID_NUMBER, last_name NAME,                 salary*12 ANN_SALARY                 FROM employees                 WHERE department_id = 50;
    Output :
    SELECT *  FROM salvu50;
    view 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 :
    CREATE SEQUENCE sequence                      [INCREMENT BY n]                      [START WITH n]                      [{MAXVALUE n | NOMAXVALUE}]                      [{MINVALUE n | NOMINVALUE}]                      [{CYCLE | NOCYCLE}]                      [{CACHE n | NOCACHE}];
    Example :
    CREATE SEQUENCE dept_deptid_seq                          INCREMENT BY 10                          START WITH 120                          MAXVALUE 9999                          NOCACHE                          NOCYCLE;
    Check if sequence is created by :
    SELECT sequence_name, min_value, max_value,                         increment_by, last_number                         FROM   user_sequences;
  4. Index - This database object is used to create a indexes in database.An Oracle server index is a schema object that can speed up the retrieval of rows by using a pointer.Indexes can be created explicitly or automatically. If you do not have an index on the column, then a full table scan occurs. 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 :
    CREATE INDEX index              ON table (column[, column]...);
    Example :
    CREATE INDEX emp_last_name_idx                  ON  employees(last_name);
  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 :
    CREATE [PUBLIC] SYNONYM synonym FOR  object;
    Example :
    CREATE SYNONYM d_sum FOR dept_sum_vu;
References : Database objects - ibm Introduction to Oracle 9i: SQL Student Guide Volume 2

Next Article
Database Objects in DBMS

A

anuragrawat1
Improve
Article Tags :
  • Misc
  • Technical Scripter
  • DBMS
Practice Tags :
  • Misc

Similar Reads

    Database Languages in DBMS
    Databases are essential for efficiently storing, managing, and retrieving large volumes of data. They utilize both software and hardware components. Where the software acts as an interface to interact with the database and hardware provide servers for physical storage and organizing data.What is a D
    9 min read
    Data Models in DBMS
    A Data Model in Database Management System (DBMS) is the concept of tools that are developed to summarize the description of the database. Data Models provide us with a transparent picture of data which helps us in creating an actual database. It shows us from the design of the data to its proper im
    8 min read
    Purpose of Database System in DBMS
    Nowadays organizations are data-dependent. efficient management and retrieval of information play a crucial role in their success. A database is a collection of data that is organized, which is also called structured data. It can be accessed or stored in a computer system. It can be managed through
    3 min read
    Data Isolation in DBMS
    In today's era effectively managing volumes of data is crucial, for businesses and organizations. Database Management Systems (DBMS) play a role in this aspect by providing tools to store, retrieve, and manipulate data. However when multiple users are. Their transactions interact with the data simul
    5 min read
    Types of Databases
    Databases are essential for storing and managing data in today’s digital world. They serve as the backbone of various applications, from simple personal projects to complex enterprise systems. Understanding the different types of databases is crucial for choosing the right one based on specific requ
    11 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences