OBJECT RELATIONAL DATABASE

If you have any queries please leave a message here
Your Message
×


object-relational database management system (ORDBMS), is a database management system (DBMS) similar to a relational database, but with an object-oriented database model: objects, classes and inheritance are directly supported in database schemas and in the query language. In addition, just as with pure relational systems, it supports extension of the data model with custom data-types and methods.


COMPLEX DATA TYPE

Consider a composite attribute - address. The address of a person in a RDBMS can be represented as :

House/Apartment
Street/Locality
City
State
Pincode

When using RDBMS, such information either needs to be represented as set attributes as shown above, or, as just one string separated by a comma or a semicolon.

If we represent the attributes of the address as separate attributes then the problem would be with respect to writing queries. For example, if we need to find the address of a person, we need to specify all the attributes that we have created for the address.

The question is -Is there any better way of representing such information using a single field? If there is such a mode of representation, then that representation should permit the distinguishing of each element of the address? The following may be one such possible attempt :

CREATE OR REPLACE TYPE address AS OBJECT
(house VARCHAR(20), street VARCHAR(25), city VARCHAR(20), state VARCHAR(20), pincode NUMBER(10));
/

Thus, address is now a new type that can be used while showing a database system schema as :

CREATE TABLE employee (emp_id NUMBER(5) PRIMARY KEY, emp_name VARCHAR(50), emp_address ADDRESS);


INSERT OPERATION

INSERT INTO employee VALUES(1000, 'Debabrata', address('12/18', 'Padmapukur Road', 'Kolkata', 'West Bengal', 700092));


UPDATE OPERATION

UPDATE employee e SET e.emp_address.house='3/8', e.emp_address.street='Sanghati Colony' WHERE e.emp_id=2000;


SELECT OPERATION


MORE EXAMPLES

CREATE OR REPLACE TYPE author AS OBJECT
(author1 VARCHAR(50), author2 VARCHAR(50), author3 VARCHAR(50));
/

CREATE TABLE books (book_id NUMBER(10) PRIMARY KEY, book_title VARCHAR(50), book_author AUTHOR, unit_price NUMBER(8,2));

INSERT INTO books VALUES(1000, 'Database System Concepts', author('Silberschatz−Korth−Sudarshan', ' ', ' '), 1560.50);

INSERT INTO books VALUES(1010, 'Beginning Linux Programming', author('Neil Matthew', 'Richard Stones', ' '), 1280.00);




TYPE INHERITANCE

CREATE OR REPLACE TYPE address AS OBJECT
(house VARCHAR(20), street VARCHAR(25), city VARCHAR(20), state VARCHAR(20), pincode NUMBER(10));
/

The keywords FINAL or NOT FINAL are used to determine inheritability.
NOT FINAL means subtypes can be derived. FINAL, (default) means that no subtypes can be derived from it.

CREATE OR REPLACE TYPE person AS OBJECT
(p_name VARCHAR(50), p_address ADDRESS, phone NUMBER(11), email VARCHAR(50)) NOT FINAL;
/

Now the type person can be inherited by the student type or the staff type.

CREATE TYPE student UNDER person
(course_code VARCHAR(25), semister INT);
/

CREATE TYPE staff UNDER person
(designation VARCHAR(25), salary NUMBER(8,2));
/


CREATE TABLE student_data (student_id NUMBER(10), personal_details STUDENT);


Direct table creation from the user define type

CREATE TABLE staff_data OF staff;



ABOUT US

QuestionSolves.com is an educational website that helps worldwide students in solving computer education related queries.

Also, different software like Visual Studio, SQL Server, Oracle etc. are available to download in different versions.

Moreover, QuestionSolves.com provides solutions to your questions and assignments also.


MORE TOPIC


Windows Command

UNIX Command

IGNOU Assignment Solution

IGNOU Question Paper Solution

Solutions of Different Questions


WHAT WE DO


Website Devlopment

Training

Home Learning

Provide BCA, MCA Projects

Provide Assignment & Question Paper Solution


CONTACT US


Follow Us