Object-relational Database - Comparison To RDBMS

Comparison To RDBMS

An RDBMS might commonly involve SQL statements such as these:

CREATE TABLE Customers ( Id CHAR(12) NOT NULL PRIMARY KEY, Surname VARCHAR(32) NOT NULL, FirstName VARCHAR(32) NOT NULL, DOB DATE NOT NULL ); SELECT InitCap(Surname) || ', ' || InitCap(FirstName) FROM Customers WHERE MONTH(DOB) = MONTH(getdate) AND DAY(DOB) = DAY(getdate)

Most current SQL databases allow the crafting of custom functions, which would allow the query to appear as:

SELECT Formal(Id) FROM Customers WHERE Birthday(Id) = Today

In an object-relational database, one might see something like this, with user-defined data-types and expressions such as BirthDay:

CREATE TABLE Customers ( Id Cust_Id NOT NULL PRIMARY KEY, Name PersonName NOT NULL, DOB DATE NOT NULL ); SELECT Formal( C.Id ) FROM Customers C WHERE BirthDay ( C.DOB ) = TODAY;

The object-relational model can offer another advantage in that the database can make use of the relationships between data to easily collect related records. In an address book application, an additional table would be added to the ones above to hold zero or more addresses for each user. Using a traditional RDBMS, collecting information for both the user and their address requires a "join":

SELECT InitCap(C.Surname) || ', ' || InitCap(C.FirstName), A.city FROM Customers C JOIN Addresses A ON A.Cust_Id=C.Id -- the join WHERE A.city="New York"

The same query in an object-relational database appears more simply:

SELECT Formal( C.Name ) FROM Customers C WHERE C.address.city="New York" -- the linkage is 'understood' by the ORDB

Read more about this topic:  Object-relational Database

Famous quotes containing the word comparison:

    He was a superior man. He did not value his bodily life in comparison with ideal things. He did not recognize unjust human laws, but resisted them as he was bid. For once we are lifted out of the trivialness and dust of politics into the region of truth and manhood.
    Henry David Thoreau (1817–1862)