GATE Data Base Management System Book

  • Upload
    mims12

  • View
    235

  • Download
    0

Embed Size (px)

Citation preview

  • 8/10/2019 GATE Data Base Management System Book

    1/12

  • 8/10/2019 GATE Data Base Management System Book

    2/12

    DATA BASE

    MANAGEMENT SYSTEM

    For

    Computer Science

    Information Technology

    By

    www.thegateacademy.com

    http://www.thegateacademy.com/http://www.thegateacademy.com/http://www.thegateacademy.com/
  • 8/10/2019 GATE Data Base Management System Book

    3/12

    Syllabus DBMS

    THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30 th Cross, 10 th Main, Jayanagar 4 th Block, Bangalore-11080 65700750 i f @ h d C i h d W b h d

    Syllabus for

    Data Base Management System

    ER-model, Relational model (relational algebra, tuple calculus), Database design (integrityconstraints, normal forms), Query languages (SQL), File structures (sequential files, indexing, Band B+ trees), Transactions and concurrency control.

    Analysis of GATE Papers(Data Base Management System)

    Year Percentage of marks Overall Percentage

    2013 7.00

    6.94

    2012 11.00

    2011 7.00

    2010 6.00

    2009 3.33

    2008 7.33

    2007 8.00

    2006 6.00

    2005 7.33

    2004 8.00

    2003 5.33

  • 8/10/2019 GATE Data Base Management System Book

    4/12

    Contents DBMS

    THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30 th Cross, 10 th Main, Jayanagar 4 th Block, Bangalore-11080 65700750 i f @ h d C i h d W b h d

    C O N T E N T S

    Chapter Page No.

    1. ER Diagrams 1 - 21 Levels of Abstraction 1 - 3 Entities 3 - 4 Relationship 4 Attribute 4 - 12 Specialization 12

    Utility of E-R Model 12 - 13 Assignment 1 14 - 16 Assignment 2 16 - 18 Answer Keys 19 Explanations 19 - 21

    2. Functional Dependencies & Normalization 22 - 51 Database Application Life cycle 22 - 24 Types of Anomalies 24 - 25

    The Concept of Functional Dependency 25 - 28 Minimal Covers 28 - 29 Testing Lossless Joins 29 - 32 Functional Dependency & The Process of Normalization 32 - 42 Assignment 1 43 - 45 Assignment 2 45 - 47 Answer Keys 48 Explanations 48 - 51

    #3. Relational Algebra & Relational Calculus 52 - 69

    Relational Algebra 52 - 53 The Projection Operator 53 - 54 Relational Algebra Operaton from Set Theory 54 - 55 Natural Joins 55 - 56 The Equijoin Operator 56 - 57 Outer Joins 57 - 58 Tuple Relational Calculus 58 - 60 The Domain Relation Calculus 60 - 61 Assignment 1 62 - 64 Assignment 2 65 - 66

    Answer Keys 67 Explanations 67 - 69

  • 8/10/2019 GATE Data Base Management System Book

    5/12

    Contents DBMS

    THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30 th Cross, 10 th Main, Jayanagar 4 th Block, Bangalore-11080 65700750 i f @ h d C i h d W b h d

    4. SQL 70 - 99

    What is SQL 70 DDL Statements 70 - 71 DML Statements 71 - 77 COLUMN Alias 77 - 79 View 79 - 82 Solved Examples 83 - 89 Assignment 1 89 - 95 Assignment 2 95 - 96 Answer Keys 97 Explanations 97 - 99

    5. Transactions and Concurrency Control 100 - 123 Transactions 100 - 102 Serializability 102 - 104 Concurrency Control Protocol 104 - 106 Time Stamps 106 - 107 Thomas s Write Rule 107 - 108 Multiple Granularity 108 - 111 Solved Examples 112 Assignment 1 113 - 117

    Assignment 2 118 - 120 Answer Keys 121 Explanations 121 - 123

    6. File Structures 124 - 148 Single Level Index 124 - 125 Types of Single Level Indexes 125 - 127 Search Trees & B Trees 127 - 131 B+ Trees 131 - 140

    Assignment 1 141 - 144 Assignment 2 144 - 145 Answer Keys 146 Explanations 146 - 148

    Module Test 149 - 161 Test Questions 149 - 156 Answer Keys 157 Explanations 157 - 161

    Reference Books 162

  • 8/10/2019 GATE Data Base Management System Book

    6/12

    Chapter 1 DBMS

    THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30 th Cross, 10 th Main, Jayanagar 4 th Block, Bangalore-11080 65700750 i f @ h d h d W b h d

    CHAPTER 1

    ER Diagrams

    DBMS Contains Information about a Particular Enterprise

    Collection of interrelated data Set of programs to access the data An environment that is both convenient and efficient to use

    Levels of Abstraction

    Physical Level

    Describes how a record (e.g., customer) is stored.

    Logical Level

    Describes data stored in database, and the relationships among the data.

    View Level

    Application programs hide details of data types. Views can also hide information (such as anemployees salary) for security purposes.

  • 8/10/2019 GATE Data Base Management System Book

    7/12

    Chapter 1 DBMS

    THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30 th Cross, 10 th Main, Jayanagar 4 th Block, Bangalore-11080 65700750 i f @ h d h d W b h d

    Points to Emphasize

    How to use Entity-Relationship (ER) modeling in database design.

    The basic concepts associated with the Entity-Relationship (ER) model. A diagrammatic technique for displaying an ER model using the Unified Modeling

    Language (UML). How to identify and resolve problems with ER models called connection traps. How to build an ER model from a requirements specification.

    What To Model?

    Static Information

    Data -- Entities

    Associations -- Relationships among entities

    Dynamic Information

    Processes -- Operations/transactions

    Integrity constraints -- Business rules/regulations and data meanings

    What is data model?

    A collection of tools for describing:-

    data

    data relationships

    data semantics

    data constraints

    Data Model

    A data model is a collection of concept that can be used to describe the structure of database.

    Schema

    The description of a database is called the database schema.

    System Model Tools

    Data flow diagram (DFD)

    Hierarchical input process and output (HIPO)

  • 8/10/2019 GATE Data Base Management System Book

    8/12

    Chapter 1 DBMS

    THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30 th Cross, 10 th Main, Jayanagar 4 th Block, Bangalore-11080 65700750 i f @ h d h d W b h d

    State transition diagrams (STD)

    Entity Relationship (ER) diagrams

    Entity-Relationship Model ER Model)

    A data model in which information stored in the database is viewed as sets of entities and sets ofrelationships among entities and it is diagram-based representation of domain knowledge, dataproperties etc...., but it is more intuitive and less mechanical. Entity Relationship is a popularhigh-level conceptual data model.

    ER diagram symbols Fig. 1.1)

    Components of E R model

    a. Entity

    b. Relationship

    c. Attributes

    Entities

    The basic object that the ER model represents is an entity, which is a thing in the real worldwith an independent existence and is distinguishable

    Examples: Student entities with unique roll numbers

    Account entities with unique account numbers

    E

    R

    R

    A

    A

    A

    A

    R E

    A

    Entity Set

    Weak Entity Set

    Relationship Set

    IdentifyingRelationship Set forWeak Entity Set

    Primary Key

    Attribute

    Multivated Attribute

    Derived Attribute

    Total participation ofEntity Set in

    RelationshiDiscriminating Attributeof Weak Entity Set

    Fig. 1.1

  • 8/10/2019 GATE Data Base Management System Book

    9/12

    Chapter 1 DBMS

    THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30 th Cross, 10 th Main, Jayanagar 4 th Block, Bangalore-11080 65700750 i f @ h d h d W b h d

    Example:- Identify two entities that might be important for a retail business.

    Solution:- Two entities for a business might include employee and customer.

    Entity Set

    A set of entities of the same type.

    Example: All the student entities in a college

    Entity sets need not be disjoint.

    Example: A person entity could be in both the customer and employee sets

    Types of Entities

    Entities with physical existence

    Example : Student, customer, book etc

    Entities with Conceptual existence

    Example: Sale, University course etc

    Relationship

    An association among two or more entities.

    Example: The relationship between a Faculty and Student i.e. faculty take course for student

    Relationship Set

    A set of relationships of the same type

    Attribute

    The particular properties of entity that describe it

    Example: A student entity might have attributes such as: Roll number, name, age, address etc.

    As all entities in an entity set have the same attributes, entity sets also have attributes - theattributes of the contained entities. The value of the attribute can be different for each entity in

    the set.

  • 8/10/2019 GATE Data Base Management System Book

    10/12

    Chapter 1 DBMS

    THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30 th Cross, 10 th Main, Jayanagar 4 th Block, Bangalore-11080 65700750 i f @ h d h d W b h d

    In ER Model attributes can be classified into the following types

    Simple and Composite Attribute Single Valued and Multi Valued attribute Stored and Derived Attributes

    Simple and Composite Attribute

    Simple attribute that consist of a single atomic value. A composite attribute is an attribute thatcan be further subdivided. For example the attribute ADDRESS can be subdivided into street,city, state, and zip code. A simple attribute cannot be subdivided. For example the attributes age,sex etc are simple attributes.

    Simple Attribute: Attribute that consist of a single atomic value.

    Example: Salary, age etc

    Composite Attribute : Attribute value not atomic.

    Example : Address : House_no: City: State

    Name : First Name: Middle Name: Last Name

    Single Valued and Multi Valued attributeA single valued attribute can have only a single value. For example a person can have only one'date of birth', 'age' etc. That is a single valued attributes can have only single value. But it can besimple or composite attribute. That is 'date of birth' is a composite attribute , 'age' is a simpleattribute. But both are single valued attributes. Multivalued attributes can have multiple values.For instance a person may have multiple phone numbers, multiple degrees etc. Multivaluedattributes are shown by a double line connecting to the entity in the ER diagram.

    Single Valued Attribute: Attribute that hold a single value

    Example1: Age

    Exampe2 : City

    Example3: Customer id

    Multi Valued Attribute: Attribute that hold multiple values.

    Example1: A customer can have multiple phone numbers, email id's etc

    Example2: A person may have several college degrees

    Stored and Derived Attributes

    The value for the derived attribute is derived from the stored attribute.

  • 8/10/2019 GATE Data Base Management System Book

    11/12

    Chapter 1 DBMS

    THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30 th Cross, 10 th Main, Jayanagar 4 th Block, Bangalore-11080 65700750 i f @ h d h d W b h d

    For example 'Date of birth' of a person is a stored attribute. The value for the attribute 'AGE' canbe derived by subtracting the 'Date of Birth'(DOB) from the current date. Stored attributesupplies a value to the related attribute.

    Stored Attribute: An attribute that supplies a value to the related attribute.

    Example: Date of Birth

    Derived Attribute: An attribute thats value is derived from a stored attri bute.

    Example : Age and its value is derived from the stored attribute Date of Birth.

    Domain of Attribute

    A set of possible values for an attribute (the type of the attribute).

    Examples: The domain of student name might be strings of some fixed length.

    The domain of roll number might be 10 digit positive integers or alphanumeric.

    Relationship Degrees

    Em lo ee

    Supplier

    Unary Binary

    Supervise

    Em lo ee De artmentWork

    ro ect Part

    Ternary

    n-ary

    Supply

    Fig. 1.2

  • 8/10/2019 GATE Data Base Management System Book

    12/12