Databases • • • • • • • • Shortfalls of file management systems Structure of a database Database administration Database Management system Hierarchical Databases Network Databases Relational Databases SQL Desirable Features in an Information System • • • • • Integrity Data independence Controlled redundancy Security Privacy Database Definition • A computerised record-keeping system. • Used by a range of users who have different requirements. – Minimal enquiries. – In-depth updating. – Restructuring. • A well-implemented database will have data integrity, data independence, controlled redundancy, security and privacy, for all users. Uses of a Database • Generally used for on-line transaction processing (OLTP) • Data warehouses are a hybrid of databases which are used for on-line analytical processing (OLAP) Structure of a database External Schema Conceptual Schema Internal Schema Physical Schema External Level • Level visible to user • Multiple views of the system – e.g. View an order - see limited product and customer information • Only the database Administrator may access the whole database at this level EXTERNAL SCHEMA • Each external view is defined by means of an external schema • Provides definitions of each external view. • Written in a Data Definition Language. • individual to the user or user group. • accessed through a 3GL, a query language or a special purpose forms or menu-based language Conceptual level • CONCEPTUAL - represents the entire information content of the database • Consists of multiple types of conceptual record. This level preserves the data independence of the database. • CONCEPTUAL SCHEMA - defines each of the various types of conceptual record, in a conceptual Data Definition Language. Internal level • INTERNAL - a low-level representation of the entire database; it consists of multiple occurrences of multiple types of internal record. It is the stored record, inasmuch as it contains all but the devicespecific information on the storage of the database. • PHYSICAL - the physical device and block addresses for each of the records. Mappings • Each level maps onto adjoining levels • conceptual / internal mapping specifies how conceptual records and fields are represented at the internal level • Changes can be made in the internal level without affecting the conceptual level • external / conceptual mapping defines the correspondence between an external view and the conceptual view DBMS - Database Management System • software handling access to the database • allows both the database administrator and all users the access to the database to which they are entitled How requests are processed • User issues request (e.g. through SQL) • DBMS intercepts and analyses request • DBMS inspects user's external schema, external to conceptual mapping, conceptual schema, conceptual to internal mapping and the storage structure definition. • DBMS executes operations on stored database. DATABASE ADMINISTRATOR (DBA) • Decide on the storage structure and access strategy • Liase with the users • Define security and integrity checks • Define a backup and recovery strategy • Monitor and respond to performance Utilities used by the DBA • • • • • • Load routines Dump/Restore routines Reorganisation routines Statistics routines Analysis routines Data dictionary (containing METADATA, which gives data descriptions and mappings) Database models • • • • • • Hierarchical Network Relational Object-oriented Hybrid Data Warehouses Relational database • Data is independent from programs and from other data • Data is represented in TABLES rather than files. (one entity corresponds to 1 table) • Column headings are described as DOMAINS. (i.e. attributes) • Items of information as TUPLES or ROWS rather than records (i.e. occurrences of the entity) Definitions • A RELATION is a collection of semantically related information, usually containing a unique key. A RELATION = a Table • FOREIGN key - a key to a different relation that is used as non-key data in this relation. (i.e. the enforcing field in the relationship) • SIMPLE key - uses one item from the row • COMPOUND key - uses more than one item / attribute • Unnormalized data - contains headings, footings, differing number of occurrences for different fields. Properties of a relation (TNF test) • All row entries are non-divisible (atomic) i.e. no such thing as arrays • All entries in a particular column are drawn from the same set (i.e. no such thing as redefines) Normalisation of data • • • • • • Collect all documents to be entered/produced Represent documents in unnormalized form Choose and identify key items, giving unnormalized data + keys Separate out repeating groups -> 1st Normal Form (1NF) Separate out part key dependencies -> 2nd Normal Form (2NF) Separate out inter-data and inter-key dependencies -> 3rd Normal Form (TNF) • Apply TNF tests • Optimise by combining relations with identical keys • Apply TNF tests again Relational database • This is a database that is perceived by its users as a collection of tables. Each table can define an ENTITY • Entities can be related through RELATIONSHIPS • Relationships are implemented by use of foreign keys in tables • Each column has a unique name within the table • All rows are distinct (no two are the same) • Row or column order is not significant • Every relation must have a key Implementation of desirable features • Integrity – A field’s validation can be declared when the field is declared. If this validation is used, then the integrity of the field remains intact. – Entity integrity - No attribute participating in the primary key of a base relation is allowed to accept null values. – Domain constraints - what are the possible valid values that can be used? Referential integrity – Through the propagation and use of foreign keys, no detail can be created where a master is needed, nor can a master be deleted without consent to the deletion of the details Implementation of desirable features • Data independence – The implementation of relational databases causes the external and conceptual schema to be data independent. The internal schema and the physical level are data dependent. • Controlled redundancy – The relational model reduces redundancy at the conceptual level Tugas Individu 1. Kunjungi http://database.about.com/od/administration/a/datab asefund.htm 2. Membuat ringkasan hasil kunjungan ke URL di atas.