23246406 dbms-unit-1

4,181 views
4,047 views

Published on

dbms unit first notes

Published in: Technology
1 Comment
5 Likes
Statistics
Notes
No Downloads
Views
Total views
4,181
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
188
Comments
1
Likes
5
Embeds 0
No embeds

No notes for slide

23246406 dbms-unit-1

  1. 1. Unit 11.1 Overview of Database Management System:Data - Data is meaningful known raw facts that can be processed and stored asinformation.Database - Database is a collection of interrelated and organized data.In general, it is a collection of files (tables).Entity: A person, place, thing or event about which information must be kept.Attribute: Piece of information describing a particular entity. These are mainly thecharacteristics about the individual entity. Individual attributes help to identify anddistinguish one entity from another. STUDENT (DATABASE NAME) Entity Attributes Personnel Name, Age, Address, Father’s Name Academic Name, Roll No., Course, Dept. NameE.g.Student (Database Name) Field name or attribute namePersonnel (Table Name) Academic (table name) ROLL COURSE Dept. NameName Father Name Age Name NOJohn Albert 24 RECORD John 12 MSC ComputerRamesh Suresh 18 Ramesh 15 BCA ComputerDBMS - Database Management System (DBMS) is a collection of interrelated data[usually called database] and a set of programs to access, update and manage those data[which form part of management system] ORIt is a software package to facilitate creation and maintenance of computerized database.
  2. 2. It is general purpose software that facilitates the following: 1. Defining: Specifying data types and structures, and constraints for data to be stored. 2. Constructing: Storing data in a storage medium. 3. Manipulating: Involves querying, updating and generating reports. 4. Sharing: Allowing multiple users and programs to access data simultaneously.Eg. Of DBMS- Access, dBase, FileMaker Pro, and FoxBASE, ORACLE etc.1.1.2 Primary goals of DBMS are:1. To provide a way to store and retrieve database information that is both convenient andefficient.2. To manage large and small bodies of information. It involves defining structures forstorage of information and providing mechanism for manipulation of information.3. It should ensure safety of information stored, despite system crashes or attempts atunauthorized access.4. If data are to be shared among several users, then system should avoid possibleanomalous results.
  3. 3. 1.2 Database Management Systems:Database Management Systems provide the following advantages and disadvantages:Advantages of DBMS: • Data independence: provides an abstract view of the data that hides the details data representation and storage. • Efficient Data Access: This is the advantage where we use variety of techniques to store and retrieve data. • Data integrity and security: we can ensure data integrity if the data is always enforced through integrity constraint. • Data administration: data" administration deals with the modeling of the data and treats data as an organizational resource, while "database" administration deals with the implementation of the types of databases that are in use. • Concurrent Access and crash recovery: It ensures concurrent access of the data in such a way that the data is being accessed by only one user a time. Also protects the system from crashes. • Reduced Application Development time: It supports all the important functions that are common to many applications.Disadvantages of a DBMS:The following are disadvantages of DBMS • Setup of the database system requires more knowledge, money, skills, and time. • The complexity of the database may result in poor performance.1.2.1 Advantages & Disadvantages of DBMS:Advantages DisadvantagesGreater flexibility Difficult to learnGood for larger databases Packaged separately from the operating system (i.e. Oracle, Microsoft Access, Lotus/IBM Approach, Borland Paradox, Claris FileMaker Pro)Greater processing power Slower processing speedsFits the needs of many medium to large- Requires skilled administratorssized organizationsStorage for all relevant data ExpensiveProvides user views relevant to tasksperformedEnsures data integrity by managingtransactions (ACID test = atomicity,consistency, isolation, durability)Supports simultaneous access
  4. 4. Enforces design criteria in relation to dataformat and structure1.2.2 Applications of DBMS:1. Banking – For customer information, accounts, and loans, and banking transactions.[all transactions]2. Airlines – For reservation and schedule information. [reservations, schedules]3. Universities – For student information, course registrations, and grades. [registration,grades]4. Credit Card Transactions – For purchases on credit card and generation of monthlystatements.5. Telecommunication – For keeping records of calls made, generating monthly bills,maintaining balances on prepaid calling cards, and storing information aboutcommunication networks.6. Finance – For storing information about holdings, sales, and purchases of financialinstruments such as stocks and bonds.7. Sales – For customer, product, and purchase information. [customers, products,purchases]8. Manufacturing – For management of supply chain and for tracking production ofitems in factories, inventories of items in warehouses/stores, and orders for items.[production, inventory, orders, supply chain]9. Human Resources – For information about employees, salaries, payroll taxes andbenefits, and generation of paychecks. [employee records, salaries, tax deductions]1.3 Various views of Data1.3.1 Data abstraction:It can be summed up as follows.1. When the DBMS hides certain details of how data is stored and maintained, it provideswhat is called as the abstract view of data.2. This is to simplify user-interaction with the system.3. Complexity (of data and data structure) is hidden from users through several levels ofabstraction.Data abstraction is used for following purposes:1. To provide abstract view of data.2. To hide complexity from user.3. To simplify user interaction with DBMS.
  5. 5. Figure: The Three Levels of AbstractionLevels of data abstraction:There are three levels of data abstraction.1. Physical level: It describes how a record (e.g., customer) is stored.Features: a) Lowest level of abstraction. b) It describes how data are actually stored. c) It describes low-level complex data structures in detail. d) At this level, efficient algorithms to access data are defined.2. Logical level: It describes what data stored in database, and the relationships amongthe data.Features: a) It is next-higher level of abstraction. Here whole Database is divided into small simple structures. b) Users at this level need not be aware of the physical-level complexity used to implement the simple structures. c) Here the aim is ease of use. d) Generally, database administrators (DBAs) work at logical level of abstraction.3. View level: Application programs hide details of data types. Views can also hideinformation (e.g., salary) for security purposes.Features: a) It is the highest level of abstraction. b) It describes only a part of the whole Database for particular group of users. c) This view hides all complexity.
  6. 6. d) It exists only to simplify user interaction with system. e) The system may provide many views for the whole system.1.4 Data ModelsA data model is a collection of concepts that can be used to describe the structure of adatabase and provides the necessary means to achieve this abstraction whereas structureof a database means the data types, relationships and constraints that should hold on thedata.Collection of conceptual tools for describing data, data relationships, data semantics andconsistency constraints. The various data models that have been proposed fall into threedifferent groups. Object based logical models, record-based logical models and physicalmodels.Object-Based Logical Models: They are used in describing data at the logical and viewlevels. They are characterized by the fact that they provide fairly flexible structuringcapabilities and allow data constraints to be specified explicitly. There are many differentmodels and more are likely to come. Several of the more widely known ones are:• The E-R model• The object-oriented model• The semantic data model• The functional data modelThe E-R ModelThe (E-R) data model is based on a perception of a real worker that consists of acollection of basic objects, called entities, and of relationships among these objects.The overall logical structure of a database can be expressed graphically by an E-Rdiagram. Which is built up by the following components:• Rectangles, which represent entity sets• Ellipses, which represent attributes• Diamonds, which represent relationships among entity sets• Lines, which link attributes to entity sets and entity sets to relationships. E.g. suppose we have two entities like customer and account, then these two entities can be modeled as follow: Account number name Customer Customer city Balanc e Customer Deposit Account FIGURE 1.3: A SAMPLE E-R DIAGRAMThe Object-Oriented ModelLike the E-R model the object-oriented model is based on a collection of objects. Anobject contains values stored in instance variables within the object. An object also
  7. 7. contains bodies of code that operate on the object. These bodies of code are calledmethods.Classes: It is the collection of objects which consist of the same types of values and thesame methods.E.g. account number & balance are instance variables; pay-interest is a method that usesthe above two variables and adds interest to the balance.Semantic ModelsThese include the extended relational, the semantic network and the functional models.They are characterized by their provision of richer facilities for capturing the meaning ofdata objects and hence of maintaining database integrity. Systems based on these modelsexist in monotype for at the time of writing and will begin to filter through the nextdecade.Record-Based Logical ModelsRecord based logical models are also used in describing data at the logical and viewlevels. In contrast to object-based data models, they are used both to specify the overalllogical structures of the database, and to provide a higher-level description of theimplementation.Record-based models are so named because the database is structured in fixed-formatrecords of several types. Each record type defines a fixed number of fields, or attributes,and each field is usually of a fixed length.The three most widely accepted record-based data models are the relational, network, andhierarchical models.Relational ModelThe relational model uses a collection of tables to represent both data and therelationships among those data. Each table has multiple columns, and each column has aunique name as follows: CUSTOMER (TABLE NAME)Customer–name Customer-street Customer-City Account-numberJohnsons Alma Pala Alto A-101Smith North Ryc A-215Hayes Main Harrison A-102Turner Dutnam Stanford A-305Johnson Alma PalaAlto A-201Jones Main Harrison A-217Lindsay Park Pittifield A-222Smith North Rye A-201 A SAMPLE RELATIONAL DATABASE
  8. 8. Network ModelData in the network model is represented by collection of records, and relationshipamong data is represented by links, which can be viewed as pointers. The records in thedatabase are organized as collections of arbitrary graphs. Such type of database is shownin the Figure 1.4.Johnsons Alma Pala Alto A-101 500Smith North Rye A-215 700Hayes Main Harrison A-102 400Turner Dutnam Stanford A-305 350Jones Main Harrison A-201 900Lindsay Park Pittifield A-217 750 A-222 700 FIGURE 1.4: A SAMPLE NETWORK DATABASEHierarchical ModelThe hierarchical model is similar to the network model in the sense that data andrelationships among data are represented by records and links, respectively. It differsfrom the network model in that records are organized as collection of trees rather thanarbitrary graphs. CUSTOMER Johnson customer street ------- Smith North ------- Hayes Main ------- A-101 500 A-201 900 Turner Putnam ------- Jones Main ------- A-215 700 Lindsay Park ------- A-201 900 A-217 350 A-102 400 A-222 700 A-305 350 FIGURE : A SAMPLE HIERACHICAL DATABASE
  9. 9. Physical Data ModelsPhysical data models are used to describe data at the lowest level. In contrast to logicaldata models, there are few physical data models in use. Two of the widely known onesare the unifying model and the frame-memory model.1.5 Instances and Schemas:Instances and Schemas are similar to types and variables in programming languages.1. Schema:The overall design of a database is called database schema. E.g., the database consists ofinformation about a set of customers and accounts and the relationship between them. Itis analogous to variable along with its type information in a program.Types of Schemas (partitioned according to levels of abstraction): a. Physical schema: It is database design at the physical level. It is hidden below logical schema, and can be changed easily without affecting application programs. b. Logical schema: It is database design at the logical level. Programmers construct applications using logical schema. It is by far the most important schema, in terms of its effect on application programs. c. Subschema: It is schema at view level.2. Instance: It is the actual content of the database at a particular point in time. It isanalogous to the value of a variable.1.6 Introduction to Database Languages & Environments1.6.1 Database Languages:We have Data Definition Languages (DDL) to specify database schemas and DataManipulation Language (DML) to express database updates and queries. In practice,these are not to separate languages but are part of a single database language, like SQL.1. Data Definition Languages (DDL)It is the language that is used to specify database schemas by a set of definitionscontained in it.2. Data Manipulation Language (DML)It is a language for accessing and manipulating the data organized by the appropriate datamodel.
  10. 10. DML is also known as query language.There are two types of DML a) Procedural DMLs b) Declarative DMLs (non-procedural DMLs)1. Procedural DMLs - This language requires user to specify what data is required andhow to get those data.2. Declarative DMLs (non-procedural DMLs) - This language requires user to specifywhat data is required without specifying how to get those data.Features of DDL: • Used to specify a database schema as a set of definitions expressed in a DDL • DDL statements are compiled, resulting in a set of tables stored in a special file called a data dictionary or data directory. • The data directory contains metadata (data about data). • The storage structure and access methods used by the database system are specified by a set of definitions in a special type of DDL called a data storage and definition language. • Basic idea of DDL: To hide implementation details of the database schemes from the users.Features of DML: • A DML is a language which enables users to access and manipulate data. • The goal is to provide efficient human interaction with the system. • There are two types of DMLs o Procedural: Here user specifies what data is needed and how to get it. o Non-procedural: Here user only specifies what data is needed. - Easier for user - May not generate code as efficient as that produced by procedural languages.1.6.2 Database System Environment:1.6.2.1 DBMS System Structure and its Components:We can explain the overall structure of DBMS/System structure and its components bythe diagram given below:
  11. 11. Figure: System Structure1. Database systems are partitioned into modules for different functions. Some functions(e.g. file systems) may be provided by the operating system.2. Broadly the functional components of a database system are: a. Query Processor: It is one of the functional components of DBMS. Ittranslates statements in a query language into low-level instructions the database managerunderstands. It may also attempt to find an equivalent but more efficient form.It contains following components:
  12. 12. a. DML compiler - It converts DDL statements to a set of tables containing metadata stored in a data dictionary.It also performs query optimization. b. DDL interpreter – It interprets DDL statements and records definitions intodata dictionary. c. Query evaluation engine – It executes low-level instructions generated byDML compiler. They mainly deal with solving all problems related to queries and queryprocessing. It helps database system simplify and facilitate access to data.b. Storage Manger (Database Manager) 1. Storage manager is a program module that provides the interface between the low-level data stored in the database and the application programs and queries submitted to the system. 2. The storage manager is responsible to the following tasks: 1. interaction with the file manager 2. efficient storing, retrieving and updating of data 3. The important components include: a. File manager: It manages allocation of disk space and data structures used to represent information on disk. b. Database manager: It is the interface between low-level data and application programs and queries. c. Transaction manager: Transaction manager ensures that the database remains in a consistent (correct) state despite system failures (e.g., power failures and operating system crashes) and transaction failures. d. DML precompiler: It converts DML statements embedded in an application program to normal procedure calls in a host language. The precompiler interacts with the query processor. e. DDL compiler: It converts DDL statements to a set of tables containing metadata stored in a data dictionary. f. Authorization and integrity manger – It conducts integrity checks and user authority to access data. g. Buffer manger – It is critical part of DB and stores temporary data. In addition, several data structures are required for physical system implementation: a. Data files: They store the database itself. b. Data dictionary: It stores information about the structure of the database. It is used heavily. Great emphasis should be placed on developing a good design and efficient implementation of the dictionary. In short, it stores metadata. c. Indices: They provide fast access to data items holding particular values.
  13. 13. 1.7 File systems/File processing systemsA file system is basically storing information in data structures called ‘files’ in theoperating system and manipulating this information via application programs thatmanipulate the files.File Processing SystemAdvantages DisadvantagesSimpler to use Typically does not support multi-user accessLess expensive· Limited to smaller databasesFits the needs of many small businesses Limited functionality (i.e. no support forand home users complicated transactions, recovery, etc.)Popular FMS’s are packaged along withthe operating systems of personal Decentralization of datacomputers (i.e. Microsoft Card file andMicrosoft Works)Good for database solutions for hand held Redundancy and Integrity issuesdevices such as Palm PilotDisadvantages of File Processing System:1. Data Redundancy – Since different programmers create the files and applicationprograms over a long period, the various files are likely to have different formats and theprograms may be written in several programming languages. Moreover, the sameinformation may be duplicated in several files, this duplication of data over several filesis known as data redundancy. Eg. The address and telephone number of a particularcustomer may appear in a file that consists of saving- account records and in a file thatconsists of checking account records. This redundancy leads to higher storage & excesscost also leads to inconsistency discussed in the next.2. Data Inconsistency – The various copies of same data may no longer agree i.e.various copies of the same data may contain different information. Eg. A changedcustomer address may be reflected in savings-account records but not elsewhere in thesystem.3. Difficulty in accessing data – In a conventional file processing system it is difficult toaccess the data in a specific manner and it is require creating an application program tocarry out each new task. Eg. Suppose that one of the bank officers needs to find out thenames of all customers who live within a particular postal-code area. We ask the officerof data-processing department to generate such a list.We have 2 choices:
  14. 14. - List all cust_names & manually do the information required - Ask the data processing dept. to have system programmer to write necessity application program Because the designers of the original system did not anticipate this request, there is no application program on hand to meet it.4. Data Isolation – Because data are scattered in various files, and files may be indifferent formats, writing new application programs to retrieve the appropriate data isdifficult.5. Integrity problems – The data stored in the database must satisfy certain types ofconsistency constraints. Eg. The balance of a bank account may never fall below aprescribed amount (say, ICICI 2500/- ). Developers enforce these constraints in thesystem by adding appropriate code in the various application programs. However, whennew constraints are added, it is difficult to change the programs to enforce them. Theproblem is compounded when constraints involve several data items from different files.6. Atomicity problems – A computer system, like any other mechanical or electricaldevice, is subject to failure. In many applications, it is crucial that, if a failure occurs, thedata be restored to the consistent state that existed prior to the failure. Eg. Beforecomputer format, we require to have a backup first. It is difficult to ensure atomicity in aconventional file processing system.7. Concurrent-access anomalies – For the sake of overall performance of the systemand faster response, many systems allow multiple users to update the datasimultaneously. In such an environment, interaction of concurrent updates may result ininconsistent data. Eg. Consider bank account A, containing $500. If two customerswithdraw funds (say $50 and $100 respectively) from account A at about the same time,the result of the concurrent executions may leave the account in an incorrect (orinconsistent) state. Suppose that the programs executing on behalf of each withdrawalread the old balance, reduce that value by the amount being withdrawn, and write theresult back. If the two programs run concurrently, they may both read the value $500, andwrite back $450 and $400, respectively. Depending on which one writes the value last,the account may contain either $450 or $400, rather than the correct value of $350. To guard against this possibility, the system must maintain some form ofsupervision. But supervision is difficult to provide because data may be accessed bymany different application programs that have not been coordinated previously.8. Security Problems – Not every user of the database system should be able to accessall the data. Eg. In a bank system, payroll personnel need to see only that part of thedatabase that has information about the various bank employees. They do not need accessto information about customer accounts. But, since application programs are added to thesystem in an ad hoc manner, enforcing such security constraints is difficult.
  15. 15. 1.7.1 Difference between DBMS and File-processing system:DBMS File-processing Systems1. Redundancies and inconsistencies in data 1. Redundancies and inconsistencies in dataare reduced due to single file formats and exist due to single file formats andduplication of data is eliminated. duplication of data.2. Data is easily accessed due to standard 2. Data cannot be easily accessed due toquery procedures. special application programs needed to access data.3. Isolation/retrieval of required data is 3. Data isolation is difficult due to differentpossible due to common file format, and file formats, and also because newthere are provisions to easily retrieve data. application programs have to be written.4. Integrity constraints, whether new or old, 4. Introduction of integrity constraints iscan be created or modified as per need. tedious and again new application programs have to be written.5. Atomicity of updates is possible. 5. Atomicity of updates may not be maintained.6. Several users can access data at the same 6. Concurrent accesses may cause problemstime i.e concurrently without problems such as . Inconsistencies.7. Security features can be enabled in 7. It may be difficult to enforce securityDBMS very easily. features.1.8 Advantages of a DBMS over file-processing system:A DBMS has three main features: (1) Centralized data management, (2) Data independence and (3) Data integration /System integrationIn a DB system, the DBMS provides the interface b/w the application programs & data.When changes are made to the data representation, the metadata maintained by theDBMS is changed but the DBMS continues to provide data to application programs inpreviously used way. The DBMS handles the task of information of data where evernecessary. This independence b/w the programs & the data is called data independence.this made program to continue irrespective of changes made in it. To provide a high
  16. 16. degree of data independence, a DBMS must include a sophisticated metadata mgmtsystem. In DBMS , all files are integrated into one system thus reducing redundancies &making data mgmt more efficient. In addition, DBMS provides centralized control of theoperational data. Some of advantages of above mention three features are:Due to its centralized nature, the database system can overcome the disadvantages of thefile-based system as discussed below.• Minimal Data Redundancy - Since the whole data resides in one central database, thevarious programs in the application can access data in different data files. Hence datapresent in one file need not be duplicated in another.This reduces data redundancy. However, this does not mean all redundancy can beeliminated. There could be business or technical reasons for having some amount ofredundancy. Any such redundancy should be carefully controlled and the DBMS shouldbe aware of it.• Data Consistency - Reduced data redundancy leads to better data consistency.• Data Integration - Since related data is stored in one single database, enforcing dataintegrity is much easier. Moreover, the functions in the DBMS can be used to enforce theintegrity rules with minimum programming in the application programs.• Data Sharing - Related data can be shared across programs since the data is stored in acentralized manner. Evennew applications can be developed to operate against the same data.• Enforcement of Standards - Enforcing standards in the organization and structure ofdata files is required and also easy in a Database System, since it is one single set ofprograms which is always interacting with the data files.• Application Development Ease - The application programmer need not build thefunctions for handling issues like concurrent access, security, data integrity, etc. Theprogrammer only needs to implement the application business rules. This brings inapplication development ease. Adding additional functional modules is also easier than infile based systems.• Better Controls - Better controls can be achieved due to the centralized nature of thesystem.• Data Independence - The architecture of the DBMS can be viewed as a 3-level systemcomprising the following: - The internal or the physical level where the data resides. - The conceptual level which is the level of the DBMS functions - The external level which is the level of the application programs or the end user.Data Independence is isolating an upper level from the changes in the organization orstructure of a lower level. For example, if changes in the file organization of a data file donot demand for changes in the functions in the DBMS or in the application programs,
  17. 17. data independence is achieved. Thus Data Independence can be defined as immunity ofapplications to change in physical representation and access technique. The provision ofdata independence is a major objective for database systems.• Reduced Maintenance - Maintenance is less and easy, again, due to the centralizednature of the system.1.9 Responsibility of Database AdministratorThe database administrator is a person having central control over data and programsaccessing that data. He coordinates all the activities of the database system; the databaseadministrator has a good understanding of the enterprise’s information resources andneeds.Functions of a DBA:Database administrators duties include:1. Schema definition: the creation of the original database schema. This involves writinga set of definitions in a DDL (data storage and definition language), compiled by theDDL compiler into a set of tables stored in the data dictionary.2. Storage structure and access method definition: writing a set of definitionstranslated by the data storage and definition language compiler.3. Schema and physical organization modification: writing a set of definitions used bythe DDL compiler to generate modifications to appropriate internal system tables (e.g.data dictionary). This is done rarely, but sometimes the database schema or physicalorganization must be modified.4. Granting user authority to access the database: granting different types ofauthorization for data access to various users5. Specifying integrity constraints: generating integrity constraints. These are consultedby the database manager module whenever updates occur.6. Routine Maintenance: It includes the following: a. Acting as liaison with users. b. Monitoring performance and responding to changes in requirements. c. Periodically backing up the database.
  18. 18. 1.10 Three levels architecture of database systemsA DBMS can be considered as a buffer between application programs, end users and adatabase designed to fulfill features of data independence. In 1975 the American NationalStandards Institute Standards Planning and Requirements Committee (ANSI-SPARC)proposed three-level architecture identified three levels of abstraction. Figure: The Three Level Architecture For a DBMSThese levels are sometimes referred to as schemas or views.1. The External or User Level: This level describes the user’s or application program’sview of the database. Several programs or users may share the same view.2. The Conceptual Level: This level describes the organization’s view of all the data inthe database, the relationships between the data and the constraints applicable to thedatabase. This level describes a logical view of the database i.e. a view lockingimplementation detail.3. The Internal or Physical Level: This level describes the way in which data is storedand the way in which data may be accessed. This level describes a physical view of thedatabase. Each level is described in terms of schema – a map of the database. The three-level architecture is used to implement data independence through two levels of mapping:
  19. 19. that between the external schema and the conceptual schema and that between theconceptual schema and the physical schema.For eg., Consider a Bank System, It uses • Customer_Details Table. • Customer_Transactions Table.At the internal level, a Customer_Details or Customer_Transaction record can bedescribed as a block of consecutive storage locations (for example, words of bytes). Thelanguage compiler hides this level of detail from programmers. Similarly, the databasesystem hides the lowest-level storage details (how data is stored and accessed) fromdatabase programmers. At the conceptual level, the table definition (the attributes datatype and width definition) and the interrelationship among the data is described. Finallyat the external level, several views of the database are defined, and database end users arealso to see those views. In addition to hiding details of the conceptual level of thedatabase, the views also provide a security mechanism to prevent users from accessingparts of the database. For e.g., tellers in the bank will be able to see only that part of thedatabase that has information on customer accounts; they cannot access informationconcerning salaries of bank employees.
  20. 20. Data ModelA data model is collection of tools for describing 1. data 2. data relationships 3. data semantics 4. data constraintsTypes of Data Models:There are basically two types of data models 1. Record based Data Models. 2. Object based Data Models.1. Record based Data Models –In Record-based models, the database is organized in fixed-format records of severaltypes. A fixed number of fields, or attributes, are defined in each record type, and eachfield is usually of a fixed length.The three most popular record-based data models are 1. Relational Data Model 2. Network Data Model 3. Hierarchical Data Model1. Relational Data Model –1. The relational model uses tables to represent the data and the relationships amongthose data.2. Each table has multiple columns, and each column is identified by a unique name.3. It is a low level model.In this database, each row in the table represents a different customer. Relationships linkrows from two tables on the basis of the key field, in this case – number.Advantages of Relational Data Model:a. Structural Independence – Relational database model has structural independence,i.e. changes made in the database structure do not affect the DBMS’s capability to accessdata.b. Simplicity – The relational model is the simplest model at the conceptual level. Itallows the designer to concentrate on the logical view of the database, leaving thephysical data storage details.c. Ease of designing, implementation, maintenance, and usage – Due to the inherentfeatures of data independence and structural independence, and the relational modelmakes it easy to design, implement, maintain and use the databases.d. Adhoc query capability – One of the main reasons for the huge popularity of therelational database model is the presence of powerful, flexible and easy-to-use querycapability. The query language of the relational database model – Structure QueryLanguage or SQL – is a fourth generation language (4GL). A 4GL concentrates on the‘what’ and not on the ‘how’ of the problem. Selective output can be achieved by giving a
  21. 21. simple query. The relational database translates the user queries into the code required toextract the desired information.Disadvantages of Relational Data Model:a. Hardware overheads – The RDBMS needs comparatively powerful hardware as ithides the implementation complexities and the physical data storage details from theusers.b. Ease of design can result in bad design – As the relational database is an easy-to-design and use system, it can result in the development and implementation of poorlydesigned database management systems. As the size of the database increases, severalproblems may creep in – system shutdown, performance degradation and data corruption.2. Network Data Model –1. In the network model, data are represented by collections of records.2. Relationships among data are represented by links.3. In this model Graph data structure is used.4. A network model permits a record to have more than one parent.Advantages of Network Data Model:a. Simplicity – The network data model is also conceptually simple and easy to design.b. Ability to handle more relationship types – The network model can handle the one-to-many and many-to-many relationships.c. Ease of data access – In the network database terminology, a relationship is a set.Each set comprises of two types of records – an owner record and a member record. In anetwork model an application can access an owner record and all the member recordswithin a set.d. Data Integrity – In a network model, no member can exist without an owner. A usermust therefore first define the owner record and then the member record. This ensures thedata integrity.e. Data Independence – The network model draws a clear line of demarcation betweenthe programs and the complex physical storage details. The application programs workindependently of the data. Any changes made in the data characteristics do not affect theapplication program.
  22. 22. f. Database standards – The standards devised by the DBTG (Database Task Group ofCODASYL Committee) form the basis of the network model. These standards werefurther enhanced by ANSI/SPARC (American National Standards Institute/StandardsPlanning and Requirements Committee) in the 1970s. All the network databasemanagement systems adhere to these standards. These standards comprise of a DDL anda DML that augments the database administration and portability.Disadvantages of Network Data Model:a. System complexity – In a network model, data are accessed one record at a time. Thismakes it essential for the database designers, administrators, and programmers to befamiliar with the internal data structures to gain access to the data. Therefore, a user-friendly database management system cannot be created using the network model.b. Lack of structural independence – Making structural modifications to the database isvery difficult in the network database model as the data access method is navigational.Any changes made to the database structure require the application programs to bemodified before they can access data. Though the network database model achieves dataindependence, it still fails to achieve structural independence.3. Hierarchical Model:1. In the hierarchical model, data are represented by collections of records.2. Relationships among data are represented by links.3. In this model Tree data structure is used.4. There are two concepts associated with the hierarchical model – segment types andparent-child relationships. Segment type is similar to the record types in the networkmodels. The information retrieved only by navigating from the root segment type to thenodes segment types. Thus you can access a segment type only via its parent segmenttype in the parent-child relationship. The operators provided for manipulating suchstructures include operators for traversing hierarchic paths up and down the trees.
  23. 23. Advantages of hierarchical Model:1. Simplicity – Since the database is based on the hierarchical structure, the relationshipbetween the various layers is logically simple. Thus, the design of a hierarchical databaseis simple.2. Data Security – Hierarchical model was the first database that offered the datasecurity that is provided and enforced by the DBMS.3. Data Integrity – Since the hierarchical model is based on the parent/child relationship,there is always a link between the parent segment and the child segment under it. Thechild segments are always automatically referenced to its parent, this model promotesdata integrity.4. Efficiency – The hierarchical database model is a very efficient one when the databasecontains a large number of one-to-many relationships and when the users require largenumber of transactions, using data whose relationships are fixed.Disadvantages of hierarchical Model1. Implementation Complexity – Although the hierarchical database model isconceptually simple and easy to design, it is quite complex to implement. The databasedesigners should have very good knowledge of the physical data storage characteristics.2. Database management problems – If you make any changes in the database structureof a hierarchical database, then it is required to make the necessary changes in all theapplication programs that access the database. Thus, maintaining the database and theapplications can become very cumbersome.3. Lack of structural independence – Structural independence exists when the changesmade to the database structure does not affect the DBMS’s ability to access data.Hierarchical database systems use physical storage paths to navigate to the different datasegments. So the application programmer should have a good knowledge of the relevantaccess paths to access the data. So if the physical structure is changed the applicationswill also have to be altered. Thus, in a hierarchical database the benefits of dataindependence are limited by structural dependence.4. Programming complexity – Due to the structural dependence and the navigationalstructure, the application programmers and the end users must know precisely how thedata is distributed physically in the database in order to access data. This requiresknowledge of complex pointer systems, which is difficult for users who have little or noProgramming knowledge.5. Implementation limitation – Many of the common relationships do not conform tothe one-to-many format required by the hierarchical model. The many-to-manyrelationships, which are more common in real life, are very difficult to implement in ahierarchical model.2. Object Based Data Models:In Object-based models, the database is organized in real world objects of several types.A number of fields, or attributes, are defined in each object type, and each field is usuallyof a variable length.
  24. 24. The two most popular object-based data models are a. Object oriented model b. E - R Model1. Object Oriented Model –1. The object-oriented model is based on a collection of objects, like the E-R model.2. An object contains values stored in instance variables within the object.3. Unlike the record-oriented models, these values are themselves objects.4. Thus objects contain objects to an arbitrarily deep level of nesting.5. An object also contains bodies of code that operate on the object. These bodies of codeare called methods.6. Objects that contain the same types of values and the same methods are grouped intoclasses.7. A class may be viewed as a type definition for objects.8. Analogy: the programming language concept of an abstract data type.9. The only way in which one object can access the data of another object is by invokingthe method of that other object. This is called sending a message to the object.10. Internal parts of the object, the instance variables and method code, are not visibleexternally.11. Result is two levels of data abstraction.For example, consider an object representing a bank account. a. The object contains instance variables number and balance. b. The object contains a method pay-interest which adds interest to the balance. c. Under most data models, changing the interest rate entails changing code in application programs. d. In the object-oriented model, this only entails a change within the pay-interest method.12. Unlike entities in the E-R model, each object has its own unique identity, independentof the values it contains: a. Two objects containing the same values are distinct. b. Distinction is maintained in physical level by assigning distinct object identifiers.Advantages of Object Oriented Data Model:a. Capability to handle large number of different data types – Traditional databasemodels like hierarchical, network and relational database are limited in their capability tostore the different types of data. For e.g., one cannot store pictures, voices and video inthese databases. But the object-oriented database can store any type of data includingtext, numbers, pictures, voice and video.b. Combination of object-oriented programming and database technology – Perhapsthe most significant characteristic of object-oriented database technology is that itcombines object-oriented programming with database technology to provide anintegrated application development system.c. Object-oriented features improve productivity – Inheritance allows one to developsolutions to complex problems incrementally by defining new objects in terms of
  25. 25. previously defined objects. Polymorphism and dynamic binding allow one to defineoperations for one object and then to share the specification of the operation with otherobjects.These objects can further extend this operation to provide behaviors that are unique tothose objects. Dynamic binding determines at runtime, which of these operations isactually executed, depending on the class of the object requested to perform theoperation. Polymorphism and dynamic binding are powerful object-oriented features thatallow one to compose objects to provide solutions without having to write code that isspecific to each object. All of these capabilities come together to provide significantproductivity advantages to database application developers. Data access – Object-oriented database represent relationships explicitly, supporting both navigational andassociative access to information. As the complexity of interrelationships betweeninformation within the database increases, the greater the advantages of representingrelationships explicitly. Another benefit of using explicit relationships is theimprovement in data access performance over relational value-based relationships.Disadvantages of Object Oriented Data Model:a. Difficult to maintain – In the real world, the data model is not static. It changes asorganizational information needs change and as missing information is identified.Consequently, the definition of objects must be changed periodically and existingdatabases migrated to conform to the new object definitions. Object-oriented databasesare semantically rich introducing a number of challenges when changing objectdefinitions and migrating databases.Object-oriented databases have a greater challenge handling schema migration because itis not sufficient to simply migrate the data representation to conform to the changes inclass specifications. One must also update the behavioral code associated with eachobject.b. Not suited for all applications – Object-oriented database systems are not suited forall applications. If it is used in situations where it is not required, then it will result inperformance degradation and high processing requirements.OODBMS is popular in areasuch as e-commerce, engineering product data management, and special purposedatabases in securities and medicine. The strength of the object model is in applicationswhere there is an underlying needed to manage complex relationships among dataobjects.E R Model (Entity Relational Model):1. The entity-relationship model is based on a perception of the world as consisting of acollection of basic objects (entities) and relationships among these objects.2. It is an object-based logical model.3. It is a high-level data model.4. An entity is a distinguishable object that exists.5. Each entity has associated with it a set of attributes describing it. E.g. number andbalance for an account entity.6. A relationship is an association among several entities.
  26. 26. E.g. A cust_acct relationship associates a customer with each account he or she has.7. The set of all entities or relationships of the same type is called the entity set orrelationship set.8. Another essential element is the E-R diagram in which the mapping cardinalitiesexpress the number of entities to which another entity can be associated via a relationshipset.9. The overall logical structure of a database can be expressed graphically by an E-Rdiagram: a. Rectangles: represent entity sets. b. Ellipses: represent attributes. c. Diamonds: represent relationships among entity sets. d. Lines: link attributes to entity sets and entity sets to relationships.

×