DATA SCIENCE &
ARTIFICIAL INTELLIGENCE
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 : [email protected] | Web : www.madeeasypublications.org
Databases
EDITIONS
© Copyright by MADE EASY Publications Pvt. Ltd.
All rights are reserved. No part of this publication may be
reproduced, stored in or introduced into a retrieval system, First Edition : 2025
or transmitted in any form or by any means (electronic,
mechanical, photo-copying, recording or otherwise),
without the prior written permission of the above mentioned
publisher of this book.
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.5 Membership Test......................................................................29
2.6 Closure of Set of Functional Dependencies and
The Relational Model.............................................. 3-21
Equivalence of Sets of Functional Dependencies.........30
1.1 Introduction................................................................................. 3
2.7 Minimal Cover............................................................................32
1.2 Database Design and ER Diagrams...................................... 3
2.8 Finding Candidate Keys..........................................................33
1.3 Entity, Attributes, Entity Set.................................................... 4
2.9 Problem Caused by Redundancy.......................................34
1.4 Relationship and Relationship Sets..................................... 4
2.10 Normalization of Relations....................................................35
1.5 Relationship Constraints.......................................................... 6
2.11 Properties of Decomposition...............................................39
1.6 Minimization of ER Diagram................................................... 8
2.12 Multivalued Dependencies...................................................40
1.7 Self Referential Relationship.................................................11
2.13 Fourth Normal Form................................................................41
1.8 Weak Entity Set..........................................................................14
Student Assignments................................................................46
1.9 Specialization and Generalization......................................17
1.10 Aggregation...............................................................................17 CHAPTER 3
1.11 Aggregation vs Ternary Relationships..............................18
Relational Algebra�������������������������������������������������51-78
Student Assignments................................................................20
3.1 Introduction...............................................................................51
3.2 Selection and Projection........................................................51
CHAPTER 2
3.3 Set Operations...........................................................................53
Database Design and Normalization�����������������22-50
3.4 The Rename Operation..........................................................54
2.1 Definition of Keys and Attributes Participating
3.5 Joins...............................................................................................55
in Keys...........................................................................................22
3.6 Division.........................................................................................58
2.2 Integrity Constraints................................................................24
3.7 The Tuple Relational Calculus..............................................64
2.3 Closure of set of FDs................................................................28
3.8 The Domain Relational Calculus.........................................69
2.4 Attribute Closure......................................................................28
Student Assignments................................................................73
iii
CHAPTER 4 CHAPTER 5
Structured Query Language (SQL)....................79-98 File Organization and Indexing........................99-130
4.1 Introduction...............................................................................79 5.1 File Organization.......................................................................99
4.2 The Form of a Basic SQL Query............................................80 5.2 Index Structure....................................................................... 101
4.3 Union, Intersect, and Except.................................................82 5.3 Multilevel Index...................................................................... 107
4.4 Nested Queries..........................................................................83 5.4 B-Trees....................................................................................... 109
4.5 Correlated Nested Queries....................................................85 5.5 Bulk Loading in B+ Tree........................................................ 121
4.6 Set-Comparison Operators...................................................85 5.6 Join Algorithms...................................................................... 123
4.7 Aggregate Operators..............................................................87 Student Assignments............................................................. 127
4.8 The Group by and Having Clauses.....................................90
4.9 NULL Values................................................................................92
Student Assignments................................................................95