1
2
3
4
5
> (Next)
- Overview of Relational Databases, SQL and PL/SQL
- Discuss the Theoretical and Physical Aspects of a Relational database E.F. Codd Fathered the concept of the Relational Datamodel. A relational model organizes DATA into TABLES and only TABLES. Tables are the lingua franca of the relational model.
- The data stored in the cells must be atomic. Each cell can only hold one piece of data.When a cell contains more than one piece of information this is known as information coding
- Data stored under columns must be of the same data type
- Each row is unique (No duplicate rows)
- Columns have no order in them
- Rows have no order in them
- Columns have a unique name
- Two fundamental integrity rules: entity integrity rule :States that the primary key cannot be totally or partially empty. referential integrity rule : States that the foreign key must either be null or match currently existing value of the primary key that it references.
- The information Rule :Information is to be represented as data stored in cells.
- The guaranteed access rule : Each data item must be accesible by a comination of table name + primary key of the row + column name .
- NULLS must be used in a consistent manner: Nulls should be simply missing data and have no values.
- An active, online data dictonary should be stored as relational tables and accesible through the regular data access language.
- The data access language must provide all means of access and be the only means of access, except possibly for low level routines : If you can access a table thorugh a utility other than SQL it might violate this rule.
- All views that can be updatable should be updatable: If you can join three tables as the basis of a view, but cannot update the view directly it violates this rule.
- There must be set-level inserts, updates and deletes :
- Physical data independence : An application cannot depend on a physical restructuring. If a file is moved to another disk it should not break the application.
- Logical Data Independance : An application should not depend on a logical restructuring. If a file is split in two it should not break the application.
- Integrity Dependance : Integrity rules should be stored in the data dictonary.
- Distribution Independance : A database should continue to work properly even if distributed.
- The nonsubversion rule: If low-level access is permitted it should not bypass security or integrity rules.
/-------------/ /------------------/ /------------/
/ Relational /--------/ Named Attributes /-----/ Tuples /
/ Tables / / (Columns or / / (Rows or /
/-------------/ / Fields ) / / Records) /
/------------------/ /------------/
A row and column intersection is called a "cell"
The columns are placeholders, having data types such as character
or integer.The rows themselves are the data.
A relational table must meet the following criteria:
CODDS TWELVE RULES
- Separate Tables and Indexes
- Place large Tables and Indexes on disks of their own
- Place frequently joined tables on separate disks, or cluster them.
- Place infrequently joined tables on the same disks if necessary (if your short on disks)
- Separate the RDBMS software from tables and indexes.
- Separate the Data Dictonary from tables and indexes.
- Separate the (undo) rollback logs and redo logs onto their own disks if possible.
- Use RAID 1 for undo or redo logs
- Use RAID 3 or 5 for Table Data.
- Use RAID 0 for indexes.
- Describe the Oracle Implementation the RDBMS and ORDBMS. Oracle is entry-level SQL-92 complaint.It Offers SQL*Plus as an interactive SQL command interpreter which can run noninteractive scripts, and a procedural programming language known as PL/SQL ( modeled after ADA and Pascal ) (stored procedures and triggers are written in PL/SQL )
- Relationships as Datatypes
- Inheritance
- Collections as Datatypes, including nesting (containers)
- User-defined (extensible) datatypes
- Improved large objects (LOBs)
- Object Types: Records or classes
- Object Views :
- Object Language: Extensions to the Oracle SQL and PL/SQL
- Object APIs : Objects supported through Oracle precompilers PL/SQL, OCI.
- Object Portability : Through the object type translator (OTT) which can port for example an Oracle8 object type to a C++ class.
- As a column of a relational table
- As an attribute within another object type.
- As part of an object view of relational tables.
- As the basis for an object table.
- As the basis for PL/SQL variables.
- Describe the use and benefits of PL/SQL
-
The major objective of physical design is to eliminate or at
least minimize contention . Follow these rules to avoid contention :
Oracle offers pre-compilers ( for embedded SQL) and a 3GL function called OCI ( Oracle Call Interface).
One of the major reasons to want an RDBMS with an Object-orientated interface (OORDBMS) is so that object orientated programs can communicate directly with the object-portion of the RDBMS instead of having to handle the object-relational mapping (composition-decompostion) dynamically within the code. Normally this situation was resolved through constructs such as cursors and software such as precompilers (Pro*C) this is known as impedance mismatch .
Oracle helps alleviate the problem of object-orientated developement and RDBMS back-end situation , with the following built-in object-orientated capabilities:
Oracle extended the already complex RDBMS with the following:
Despite these advancements Oracle does not support multiple inheritance, polymorphism, or constraints on object attributes (such as referential integrity).The Oracle8 Open Type System (OTS) is a repositary for all object types, as well as external object types from other languages or systems.
Within OTS, there is a datatype hierarchy that has as its foundation the built-in Oracle8 datatypes (VARCHAR2,NUMBER,etc).Also user defined datatypes can be built on any of the built-in datatypes plus previously user-defined datatypes. When creating user-defined datatypes these can be used :
Extended Oracle SQL manages the object types with the commands:
CREATE TYPE , ALTER TYPE , DROP TYPE , GRANT/REVOKE TYPE
PL/SQL is a Procedural Language extension to Oracle's version of ANSI standard SQL. SQL is non-procedural language , the programmer only describes what work to perform. How to perform the work is left to the "Oracle Optimizer", in contrast PL/SQL is like any 3GL procedural language, it requires step by step instructions defininig what to do next.
PL/SQL combines the power and flexibility of SQL (4GL) with the procedural constructs of a 3GL. This results in a robust, powerful language suited for designing complex applications.
