Monday, October 27, 2014

Data Modeling

Data modeling is the analysis of data objects that are used in a business or other context and the identification of the relationships among these data objects. Data modeling is a first step in doing object-oriented programming.

Data modeling is the formalization and documentation of existing processes and events that occur during application software design and development. Data modeling techniques and tools capture and translate complex system designs into easily understood representations of the data flows and processes, creating a blueprint for construction and/or re-engineering. 

A data model can be thought of as a diagram or flowchart that illustrates the relationships between data. Although capturing all the possible relationships in a data model can be very time-intensive, it's an important step and shouldn't be rushed. Well-documented models allow stake-holders to identify errors and make changes before any programming code has been written.
Data modelers often use multiple models to view the same data and ensure that all processes, entities, relationships and data flows have been identified. There are several different approaches to data modeling, including:
Conceptual Data Modeling - identifies the highest-level relationships between different entities.
Enterprise Data Modeling - similar to conceptual data modeling, but addresses the unique requirements of a specific business.
Physical Data Modeling - represents an application and database-specific implementation of a logical data model.
Logical Data Modeling - illustrates the specific entities, attributes and relationships involved in a business function. Serves as the basis for the creation of the physical data model.


Database Object

Database Object
Definition - What does Database Object mean?
A database object in a relational database is a data structure used to either store or reference data. The most common object that people interact with is the table. Other objects are indexes, stored procedures, sequences, views and many more.

When a database object is created, a new object type cannot be created because all the various object types created are restricted by the very nature, or source code, of the relational database model being used, such as Oracle, SQL Server or Access. What is being created is instances of the objects, such as a new table, an index on that table or a view on the same table.
Explanation of Database Object
Two small but important distinctions are needed:
  1. An object type is the base concept or idea of an object; for example, the concept of a table or index.
  2. An object instance is an example of an object type. For example, a table called CUSTOMER_MASTER is an instance of the object type TABLE.
Most of the major database engines offer the same set of major database object types:
  • Tables
  • Indexes
  • Sequences
  • Views
  • Synonyms
Although there are subtle variations in the behavior and the syntax used for the creation of these major database object types, they are almost identical in their concept and what they mean. A table in Oracle behaves almost exactly as a table in SQL Server. This makes work much easier for the database administrator. It is analogous to moving from one car to another made by a different manufacturer; the switches for turning the headlights on may be in different locations, but the overall layout is broadly similar.

When creating an object instance, it is a good idea to follow an easy-to-understand naming convention. This is especially important for database designers whose products will be used by several people. It is also helpful to make work as simple as possible for in-house database administrators by reducing the number of queries made to the creator later. A simple guideline is to add suffixes. Here are two examples:
  • Suffix all the master tables using _MASTER, e.g., CUSTOMER_MASTER, ACCOUNTS_MASTER and LOANS_MASTER).
  • Suffix all transactional tables using the suffix _TRANS, e.g., DAILY_TRANS, LOANS_TRANS and INTERBANK_TRANS.

Database Objects

Oracle Database recognizes objects that are associated with a particular schema and objects that are not associated with a particular schema, as described in the sections that follow.

Schema Objects

schema is a collection of logical structures of data, or schema objects. A schema is owned by a database user and has the same name as that user. Each user owns a single schema. Schema objects can be created and manipulated with SQL and include the following types of objects:

Clusters
Constraints
Database links
Database triggers
Dimensions
External procedure libraries
Index-organized tables
Indexes
Indextypes
Java classes, Java resources, Java sources
Materialized views
Materialized view logs
Object tables
Object types
Object views
Operators
Packages
Sequences
Stored functions, stored procedures
Synonyms
Tables
Views

Nonschema Objects

Other types of objects are also stored in the database and can be created and manipulated with SQL but are not contained in a schema:

Contexts
Directories
Parameter files (PFILEs) and server parameter files (SPFILEs)
Profiles
Roles
Rollback segments
Tablespaces
Users