COMPUTER SCIENCE &
INFORMATION TECHNOLOGY
         Databases
            Comprehensive Theory
  with Solved Examples and Practice Questions
              www.madeeasypublications.org
              MADE EASY Publications Pvt. Ltd.
    Corporate Office: 44-A/4, Kalu Sarai (Near Hauz Khas Metro
            Station), New Delhi-110016 | Ph. : 9021300500
Email : infomep@madeeasy.in | Web : www.madeeasypublications.org
                                                                                   First Edition : 2015
                         Databases                                                 Second Edition : 2016
                                                                                   Third Edition : 2017
                                                                        EDITIONS
       © Copyright by MADE EASY Publications Pvt. Ltd.                             Fourth Edition : 2018
    All rights are reserved. No part of this publication may be                    Fifth Edition : 2019
   reproduced, stored in or introduced into a retrieval system,                    Sixth Edition : 2020
     or transmitted in any form or by any means (electronic,                       Seventh Edition : 2021
      mechanical, photo-copying, recording or otherwise),                          Eighth Edition : 2022
   without the prior written permission of the above mentioned                     Ninth Edition : 2023
                        publisher of this book.
                                                                                   Tenth Edition : 2024
      MADE EASY Publications Pvt. Ltd. has taken due care
      in collecting the data and providing the solutions, before
      publishing this book. Inspite of this, if any inaccuracy or
      printing error occurs then MADE EASY Publications Pvt.
      Ltd. owes no responsibility. We will be grateful if you could
      point out any such error. Your suggestions will be appreciated.
                                                                                 Databases
CHAPTER 1                                                                                                  2.10 Normalization of Relations....................................................36
                                                                                                           2.11 Properties of Decomposition...............................................40
The Relational Model...................................... 3-22
                                                                                                           2.12 Multivalued Dependencies...................................................41
1.1      Introduction................................................................................. 3
                                                                                                           2.13 Fourth Normal Form................................................................42
1.2      Database Design and ER Diagrams...................................... 3
                                                                                                                   Student Assignments................................................................47
1.3      Entity, Attributes, Entity Set.................................................... 4
1.4      Relationship and Relationship Sets..................................... 4
                                                                                                           CHAPTER 3
1.5      Relationship Constraints.......................................................... 6
                                                                                                           Relational Algebra........................................ 53-82
1.6      Minimization of ER Diagram................................................... 8
                                                                                                           3.1     Introduction...............................................................................53
1.7      Self Referential Relationship.................................................11
                                                                                                           3.2     Selection and Projection........................................................53
1.8      Weak Entity Set..........................................................................14
                                                                                                           3.3     Set Operations...........................................................................55
1.9      Specialization and Generalization......................................17
                                                                                                           3.4     The Rename Operation..........................................................56
1.10 Aggregation...............................................................................17          3.5     Joins...............................................................................................57
1.11 Aggregation vs Ternary Relationships..............................18                                  3.6     Division.........................................................................................60
         Student Assignments................................................................20             3.7     The Tuple Relational Calculus..............................................66
                                                                                                           3.8     The Domain Relational Calculus.........................................71
CHAPTER 2                                                                                                          Student Assignments................................................................76
Database Design and Normalization.......... 23-52
                                                                                                           CHAPTER 4
2.1      Definition of Keys and Attributes
         Participating in Keys................................................................23           Structured Query Language (SQL)...........83-102
2.2      Integrity Constraints................................................................25           4.1     Introduction...............................................................................83
2.3      Closure of set of FDs................................................................29           4.2     The Form of a Basic SQL Query............................................84
2.4      Attribute Closure......................................................................29         4.3     Union, Intersect, and Except.................................................86
                                                                                                           4.4     Nested Queries..........................................................................87
2.5      Membership Test......................................................................30
                                                                                                           4.5     Correlated Nested Queries....................................................89
2.6      Closure of Set of Functional Dependencies and
                                                                                                           4.6     Set-Comparison Operators...................................................89
         Equivalence of Sets of Functional Dependencies.........31
                                                                                                           4.7     Aggregate Operators..............................................................91
2.7      Minimal Cover............................................................................33
                                                                                                           4.8     The Group by and Having Clauses.....................................94
2.8      Finding Candidate Keys..........................................................34                4.9     NULL Values................................................................................96
2.9      Problem Caused by Redundancy.......................................35                                     Student Assignments................................................................99
                                                                                                                                                                                                       iii
                Databases
CHAPTER 5                                                                                                 6.3   Shared-Exclusive Locking................................................... 128
Transaction................................................ 103-126                                       6.4   Two Phase Locking Protocol (2PL)................................... 128
5.1     Introduction............................................................................ 103      6.5   Time Stamp based Concurrency Control...................... 134
5.2     ACID Properties...................................................................... 104
                                                                                                          6.6   The Timestamp Ordering Algorithm............................. 134
5.3     Types of Failures..................................................................... 106
                                                                                                          6.7   Multiversion Concurrency Control Techniques.......... 138
5.4     Transaction States................................................................. 107
5.5     Schedule................................................................................... 107         Student Assignments............................................................. 139
5.6     Concurrent Execution of Transaction............................. 108
5.7     Problems because of Concurrent Execution............... 109                                       CHAPTER 7
5.8     Serializability........................................................................... 110
                                                                                                          File Organization and Indexing...............141-172
5.9     Uses of Serializability............................................................ 111
                                                                                                          7.1   File Organization.................................................................... 141
5.10 Classification of Schedules................................................. 111
                                                                                                          7.2   Index Structure....................................................................... 143
        Student Assignments............................................................. 123
                                                                                                          7.3   Multilevel Index...................................................................... 149
CHAPTER 6                                                                                                 7.4   B-Trees....................................................................................... 151
Concurrency Control Techniques...........127-140                                                          7.5   Bulk Loading in B+ Tree....................................................... 163
6.1     Introduction............................................................................ 127      7.6   Join Algorithms...................................................................... 165
6.2     Look Granularity.................................................................... 127                Student Assignments............................................................. 169
                                                                                                                                                                                               iv