DATABASE MODELLING Database Structure A database structure is the description and definition of all basic structures such as simple conceptual files, datatypes, relationships, and constraints that should hold on the data. In any data model it is important to distinguish between the description of the database and the database itself. 1 Database Schema The description of a database is called the database schema (or the metadata). A database schema is specified during database design and is not expected to change frequently. SUPPLIER SNO Sname Status City Pname Color Weight PART PNO SUPPLY SNO PNO 2 QTY Database State (Instance) The data in the database at a particular moment of time is called the database state (or instance). SUPPLIER SNO S1 S2 S3 S4 S5 Sname Ahmed Badran Aly Saleh Sadek Status 20 10 10 30 20 City Cairo Cairo Alex. Tanta Cairo PNO P1 P2 P3 P4 P5 P6 Pname Nut Bolt Screw Cam Cog Screw Color Red Green Blue Red Black Black Weight 12 15 15 17 20 14 PART SUPPLY SNO S1 S1 S1 S2 S2 S4 S4 S5 PNO P1 P2 P3 P1 P3 P2 P3 P2 3 QTY 100 200 100 150 100 200 300 100 Data Models A data model is a set of concepts that can be used to describe a database structure. Data Models High-level (conceptual) Data Models Relational Implementation Data Models Hierarchical Network 4 Low-level (physical) Data Models Objectoriented Database System Architecture The Three-level Architecture End Users External Level External View1 External Viewn external/conceptual mapping Conceptual Level Conceptual Schema conceptual/internal mapping Internal Schema Internal Level Stored Database 5 Data Independence Data independence is the capacity to change the schema at one level of a database system without having to change the schema at the next higher level. defined: 1. Logical data independence is the capacity to change the conceptual schema without having to change external schemas or Logical data application programs. 2. Physical data independence is the capacity to change the internal schema without having to change the conceptual (or external) schemas. 6 Classification of DBMSs Classification according to Data Model DBMSs Relational Hierarchical Network Objectoriented The relational data model represents the database as a collection of tables, where each table can be stored as separate file. Examples of DBMSs are: DB2 from IBM ORACLE from Oracle Corporation Informix from Informix SyBase from OpenSoft SQL Server from Microsoft MS-ACCESS from Microsoft commercial 7 relational Example of a Relational Database SUPPLIER SNO S1 S2 S3 S4 S5 Sname Ahmed Badran Aly Saleh Sadek Status 20 10 10 30 20 City Cairo Cairo Alex. Tanta Cairo PNO P1 P2 P3 P4 P5 P6 Pname Nut Bolt Screw Cam Cog Screw Color Red Green Blue Red Black Black Weight 12 15 15 17 20 14 PART SUPPLY SNO S1 S1 S1 S2 S2 S4 S4 S5 PNO P1 P2 P3 P1 P3 P2 P3 P2 8 QTY 100 200 100 150 100 200 300 100 The network data model represents data as a record types. An example of a network model is known as the CODASYL DBTG model. Student Course IS_A Course_offerings HAS_A Student_grades Section Prerequisite Section_grades Grade_Report The hierarchical data model represents data as hierarchical tree structure. Each hierarchical represents a number of related records. 9 The object-oriented data model defines a database in terms of objects, their properties, and their operations. Objects with the same structure and behavior belong to a class, and classes are organized into hierarchies or acyclic graphs. The operations of each class are specified in terms of predefined procedures called methods. Experimental OO prototypes: The ORION system developed at MCC, The OpenOODB system at Texas Instruments, The IRIS system developed at HP laboratories, The ODE system at ATT Bell Labs, and The ENCORE/ObServer project at Brown University. Commercially available OO systems: GEM-STONE/OPAL of SerioLogic, ONTOS of Ontologic, Objectivity of Objectivity Inc., Versant of Versant Technologies, ObjectStore of Object Design, and, O2 of O2 Technology. 10 Classification according to number of users 1.Single user systems support only one user at a time and are mostly used with personal computers. 2.Multiuser systems, which include the majority of DBMSs, support many users concurrently. Classification according to number of sites 1.Centralized DBMS where the data is stored at a single computer site. Most DBMSs are centralized. A centralized DBMS can support multiple users, but the DBMS and the database themselves reside totally at a single computer site. 2. Distributed DBMS (DDBMS) can have the actual database and DBMS software distributed over many sites, connected by a computer network. Many DDBMSs use a client-server architecture. 11