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:

    Certainly there is not the fight recorded in Concord history, at least, if in the history of America, that will bear a moment’s comparison with this, whether for the numbers engaged in it, or for the patriotism and heroism displayed.
    Henry David Thoreau (1817–1862)