Saturday 1 January 2011

Constraints

Constraints

Constraints allow you to further restrict the domain of an attribute. For instance, a constraint can restrict a given integer attribute to values between 1 and 10. Constraints provide one method of implementing business rules in the database. SQL implements constraint functionality in the form of check constraints.
Constraints restrict the data that can be stored in relations. These are usually defined using expressions that result in a boolean value, indicating whether or not the data satisfies the constraint. Constraints can apply to single attributes, to a tuple (restricting combinations of attributes) or to an entire relation.
Since every attribute has an associated domain, there are constraints (domain constraints). The two principal rules for the relational model are known as entity integrity and referential integrity.

What is ENTITY

An entity may be defined as a thing which is recognized as being capable of an independent existence and which can be uniquely identified. An entity is an abstraction from the complexities of some domain. When we speak of an entity we normally speak of some aspect of the real world which can be distinguished from other aspects of the real world.
An entity may be a physical object such as a house or a car, an event such as a house sale or a car service, or a concept such as a customer transaction or order. Although the term entity is the one most commonly used, following Chen we should really distinguish between an entity and an entity-type. An entity-type is a category. An entity, strictly speaking, is an instance of a given entity-type. There are usually many instances of an entity-type. Because the term entity-type is somewhat cumbersome, most people tend to use the term entity as a synonym for this term.
Entities can be thought of as nouns. Examples: a computer, an employee, a song, a mathematical theorem.

Domain

Domain-A domain name is a sequence of "labels".
We are all reasonably familiar with domain names.  For example, "www.cavebear.com" is a sequence of the labels "com", "cavebear", and "www".
Notice that I have listed the labels in an order reverse from the way they appear in the domain name.  This represents the fact that the labels of a domain name have the more global part at the end.  Each label, as one moves from right-to-left represents a name within the scope of those labels which appear to its right.
Thus, the label "cavebear" is contained within the label "com".   And the label "www" is contained within "cavebear" (which is contained within "com".)
As you can guess, this nesting of names can be carried to considerable depth.
The most important, most global, rightmost label is not usually shown in domain name.   The "root", as it is usually called is simply ".".  (This is distinct from the dots used to separate labels.)
The DNS essentially translates a sequence of "labels" into a record of some sort.
The DNS contains a number of record types.  The most typical ones contain the IP addresses of host computers.  Other types of records contain aliases for labels, information about DNS servers, information about the location of exchangers for electronic mail, etc.
The way in which the DNS resolves a domain name query into a record is roughly as follows:
Suppose a user's computer wants to read a web page from host "www.cavebear.com".  That computer would contact a local name server, the address of which is configured into the user's computer by some administrative mechanism.

OODBMS vs ORDBMS


  • ORDBMS vs. ORDBMS
    • similarities: both support user-defined ADTs, constructed types, reference types,
      object identity, query language
    • differences: ORDBMSs add new data types to RDBMS; OODBMSs add
DBMS functionalities to a programming language
  • Integration with host language
    • OODBMS: seamless integration with C++/Small talk
    • ORDBMS: integration is only through embedded SQL in a host language
  • Application requirement
    • OODBMS:
      • few large objects fetched occasionally: few disk I/O
      • long duration transactions on in-memory objects
      • ability to cache objects in memory
    • ORDBMS:
      • large collection of data
      • extensive disk I/O
      • short transactions
  • Query language
    • OODBMS:
      • Query processing is relatively inefficient
      • No standard available
    • ORDBMS:
      • Query facilities is the centerpiece
      • SQL-based standards available: SQL3, SQL4
An object database (also object-oriented database) is a database model in which information is represented in the form of objects as used in object-oriented programming.
oRdbms-An object-relational database (ORD), or 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 ...

Characteristics of Object-Oriented Databases in Depth


Object-oriented database technology is a marriage of object-oriented programming and database technologies. Figure 1 illustrates how these programming and database concepts have come together to provide what we now call object-oriented databases.
Introduction to RDBMS OODBMS and ORDBMS
Perhaps the most significant characteristic of object-oriented database technology is that it combines object-oriented programming with database technology to provide an integrated application developmenthttp://images.intellitxt.com/ast/adTypes/mag-glass_10x10.gif system. There are many advantages to including the definition of operations with the definition of data. First, the defined operations apply ubiquitously and are not dependent on the particular database application running at the moment. Second, the data types can be extended to support complex data such as multi-media by defining new object classes that have operations to support the new kinds of information.
Other strengths of object-oriented modeling are well known. For example, inheritance allows one to develop solutions to complex problems incrementally by defining new objects in terms of previously defined objects. Polymorphism and dynamic binding allow one to define operations for one object and then to share the specification of the operation with other objects. These objects can further extend this operation to provide behaviors that are unique to those objects. Dynamic binding determines at runtime which of these operations is actually executed, depending on the class of the object requested to perform the operation. Polymorphism and dynamic binding are powerful object-oriented features that allow one to compose objects to provide solutions without having to write code that is specific to each object. All of these capabilities come together synergistically to provide significant productivity advantages to database application developers.
A significant difference between object-oriented databases and relational databases is that object-oriented databases represent relationships explicitly, supporting both navigational and associative access to information. As the complexity of interrelationships between information within the database increases, so do the advantages of representing relationships explicitly. Another benefit of using explicit relationships is the improvement in data access performance over relational value-based relationships.
A unique characteristic of objects is that they have an identity that is independent of the state of the object. For example, if one has a car object and we remodel the car and change its appearance, the engine, the transmission, and the tires so that it looks entirely different, it would still be recognized as the same object we had originally. Within an object-oriented database, one can always ask the question, “is this the same object I had previously?”, assuming one remembers the object’s identity. Object-identity allows objects to be related as well as shared within a distributed computing network.
All of these advantages point to the application of object-oriented databases to information management problems that are characterized by the need to manage:
  • a large number of different data types,
  • a large number of relationships between the objects, and
  • objects with complex behaviors.
Application areas where this kind of complexity exists includes engineering, manufacturing, simulations, office automation and large information systems.

Database Management System

To combat the limitations of RDBMS and meet the challenge of the increasing rise of the Internet and the Web, programmers developed object-oriented databases in the 1980s. The main objective of Object-Oriented Databasehttp://images.intellitxt.com/ast/adTypes/mag-glass_10x10.gifManagement Systems, commonly known as OODBMS, is to provide consistent, data independent, secure, controlled and extensible data management services to support the object-oriented model. They were created to handle big and complex data that relational databases could not.
There are important characteristics involved with object-oriented databases. The most important characteristic is the joining of object-oriented programming with database technology, which provides an integrated application developmenthttp://images.intellitxt.com/ast/adTypes/mag-glass_10x10.gifsystem. Object-oriented programming results in 4 main characteristics: inheritances, data encapsulation, object identity, and polymorphism. Inheritance allows one to develop solutions to complex problems incrementally by defining new objects in terms of previously defined objects.
Data encapsulation or simply encapsulation allows the hiding of the internal state of the objects. Encapsulated objects are those objects that can only be assessed by their methods instead of their internal states. There are three types of encapsulated objects users and developers should recognize. The first is full encapsulation, in which all the operations on objects are done through message sending and method execution. The second is write encapsulation, which is where the internal state of the object is visible only for reading operations. The third is partial encapsulation, which involves allowing direct access for reading and writing for only a part of the internal state.
Object identity allows objects of the database to be independent of each other. Polymorphism and dynamic binding allow one to define operations for one object and then to share the specification of the operation with other objects. This allows users and/or programmers to compose objects to provide solutions without having to write code that is specific to each object.
The language important to OODBMS is data definition and manipulation language (DDML). The use of this language allows persistent data to be created, updated, deleted, or retrieved. An OODBMS needs a computational versus a relational language because it can be used to avoid impedance mismatch. DDML allows users to define a database, including creating, altering, and dropping tables and establishing constraints. DDMLs are used to maintain and query a database, including updating, inserting, modifying, and querying data.
The OODBMS has many advantages and benefits. First, object-oriented is a more natural way of thinking. Second, the defined operations of these types of systems are not dependent on the particular database application running at a given moment. Third, the data types of object-oriented databases can be extended to support complex data such as images, digital and audio/video, along with other multi-media operations. Different benefits of OODBMS are its reusability, stability, and reliability. Another benefit of OODBMS is that relationships are represented explicitly, often supporting both navigational and associative access to information. This translates to improvement in data access performance versus the relational model.
Another important benefit is that users are allowed to define their own methods of access to data and how it will be represented or manipulated. The most significant benefit of the OODBMS is that these databases have extended into areas not known by the RDBMS. Medicine, multimedia, and high-energy physics are just a few of the new industries relying on object-oriented databases.
As with the relational database method, object-oriented databases also has disadvantages or limitations. One disadvantage of OODBMS is that it lacks a common data model. There is also no current standard, since it is still considered to be in the development stages.