290 likes | 502 Views
Database Management Systems. Without databases data and programs are dependent upon each other An input file makes no sense without the program to give it structure and meaning Data is not self describing Ex. 10 1011 Jones 1502 Evans ABC What does this mean?. Database Management Systems.
E N D
Database Management Systems • Without databases data and programs are dependent upon each other • An input file makes no sense without the program to give it structure and meaning • Data is not self describing • Ex. 10 1011 Jones 1502 Evans ABC • What does this mean?
Database Management Systems • Sometimes comments in program convey meaning or documentation. • Same data element appears in many files • Data storage is wasted • Data integrity is a key concern • If an element is updated in one file what happens to the other files??
Database Management Systems • Need to write programs to “recover” relationships between data elements • Ex. Personnel file and projects file. Need to write a program to determine which people work on which project • Time consuming and redundant • Each programmer “owns” the data file associated with his program
Database Management Systems • Programmers us special/unique conventions for coding which might not be documented • Security issues • Who is permitted to view data? • Who is permitted to change data? • Data deletions or updates can produce inconsistencies • Dangling references
Database Management Systems • Terminated processes can result in data inconsistencies • Ex. A banking transaction deducts money from one account then terminates before it can complete transfer of funds to second account. • Physical concerns: • Adding new fields, storage devices,extra memory.
Database Management Systems • Definition • A database is a self describing collection of data elements that presents a uniform service interface • A database management system is a software product that implements access to a database.
Questions for Files • What file structure for each? • Should we use codes, prefix or suffix? • How would we list class ranking of students • How often is Bob Perkoski name in file • Is it consistent? • If Bob drops a course what gets updated? • If school changes ID # what gets updated? • An RA wants to get a list of Bob’s professors?
Database Management Systems • Database Models • Definition • A set of concepts that can be used to describe the structure of the database. • Data types • Relationships • Constraints • Manipulation of the data
Database Management Systems • Database Models • Relational Database • Object Oriented Database Model • Deductive Database Model • Hierarchial Database Model • Network Datbase Model
Database Management Systems • Relational Database Model • Uses tables to organize data • Each table corresponds to an entity • Each row represents an instance of that entity • Each column represents an attribute of the entity • Tables can be related to each other
Database Management Systems • Relational Model Example:Salespeople Snum= unique number for each salesperson Sname=name of salesperson Comm = commission rate
Database Management Systems • Object Oriented Database Model • Represents an entity as a class • A class captures both attributes and behavior • Instances of the class are called objects • Within an object the class attributes take on specific values which distinguish one object from another • Does not restrict to native data types such as real,integer, can use other objects
Database Management Systems • Object Oriented Example • Class • Cat • Attributes • Color, weight, breed • Behavior • Scratches, sleeps,purrs • An instance of the cat class is an object with specific attributes • Example – an attribute of a cat can be owner and the owner can be a student object
Database Management Systems • Deductive Database Model • Also known as inferential model • Stores data and elementary facts called axioms • Other facts can be derived as needed • Ex. Fact Student owns cat :stuOwnsCat(S,C) • Can deduct if two students own the same cat and deduct new relationship:catmates.
Database Management Systems • Hierarchial Database Model • Relatively old, dating from 1950’s • Uses a tree structure such as a company org chart • President –> VPresident ->Dept1-Dept2-Dept3->Employees • Can be translated into a linear list
Database Management Systems • Hierarchial Continued • Data elements organized as tabular rows • Each row for each instance of an entity • Row position implies a relationship to other rows • Relationships represented by logical proximity in the linearized tree
Database Management Systems • Hierarchial Continued • Example • President ( name = jones, phone =223-3332) • Vice President ( name = boyd,…) • Department ( name =marketing) • Employee ( name = Smith) • Employee(name=Jones) • Department ( name = manufacturing) • Employee ( name = Williams) • Vice President ( name = Graham, phone =345-6789) • Department ( name =human resources)
Database Management Systems • Network Database Model • Replaces the hierarchial tree with a graph network • If employee works for two depts in previous example the hierarchial model breaks down. • Network model maintains relationships with a system of intersecting chains
Database Management Systems Department Electrical Employee Charlie Other workers Charlie works for Electrical Department Other departments Charlie works for
Database Management Systems DB Designer DB User Storage/Retrieval Services Schema Compiler User Interface Operating System Data Dictionary Data
Database Management Systems • Components of DB System • Lowest level is data and meta-data ( data that describes the data) • Cat and student example. Store attributes of cat like color , weight Store that Cat is name of a storage table and name of attributes
Database Management Systems • Conceptual Schema • App designer provides names of entities, attributes and relationships in a machine readable script called a conceptual schema • Ex. For the student –Cat example • Would describe the Cat table and Student Table and how Student rows relate to Cat rows • DBMS compiles the schema into compact form for reference by other parts of the system
Database management Systems • Interactive Interface • Users request services via the interface • Uniform to users • It uses the data dictionary to confirm existence and compatibility of data lements used in the request • The interface uses second module to process storage and retrieval requests, optimization
Database management Systems • Three Levels of Database Services • Physical Level • Furthest removed from application entities • Not always accessible to designer • If accessible the physical schema is a machine readable script that addresses issues like location of files, buffer size, proximity of storage, file structures
Database management Systems • Conceptual Level • Since the storage details are isolated the conceptual level doesn’t need to worry about it • Includes tables, objects, inference rules, entities, relationships, constraints, and security • Physical Data Independence – the decoupling of the application programs from the underlying hardware and data structures
Database Management Systems • External Level • Different external views of the same conceptual data • Example: some views may have all attributes of an entity while others have a subset • External Level should adapt to changes in the conceptual schema – Logical Data Independence • Ex. Add new attributes to an entity but old view still works
Database Management Systems • Relational Database Models • Example:
Salespeople Customers Orders