Transcript
Syllabus
DBMS
ER-model, Relational model (relational algebra, tuple calculus), Database design (integrity constraints, normal forms), Query languages (SQL), File structures (sequential files, indexing, B and B+ trees), Transactions and concurrency control.
th
th
th
Contents
DBMS
1
Levels of Abstraction Entities Relationship Attribute Specialization Utility of E-R Model Assignment 1 Assignment 2 Answer Keys Explanations
1-3 3-4 4 4 - 12 12 12 - 13 14 - 16 16 - 18 19 19 - 21
Database Application Life cycle Types of Anomalies The Concept of Functional Dependency Minimal Covers Testing Lossless Joins Functional Dependency & The Process of Normalization Assignment 1 Assignment 2 Answer Keys Explanations
22 - 24 24 - 25 25 - 28 28 - 29 29 - 32 32 - 42 43 - 45 45 - 47 48 48 - 51
Relational Algebra The Projection Operator Relational Algebra Operaton from Set Theory Natural Joins The Equijoin Operator Outer Joins Tuple Relational Calculus The Domain Relation Calculus Assignment 1 Assignment 2 Answer Keys Explanations
52 - 53 53 - 54 54 - 55 55 - 56 56 - 57 57 - 58 58 - 60 60 - 61 62 - 64 65 - 66 67 67 - 69
2.
#3.
th
th
th
Contents
DBMS
4.
What is SQL DDL Statements DML Statements COLUMN Alias View Solved Examples Assignment 1 Assignment 2 Answer Keys Explanations
70 70 - 71 71 - 77 77 - 79 79 - 82 83 - 89 89 - 95 95 - 96 97 97 - 99
Transactions Serializability Concurrency Control Protocol Time Stamps Thomas’s Write Rule Multiple Granularity Solved Examples Assignment 1 Assignment 2 Answer Keys Explanations
100 - 102 102 - 104 104 - 106 106 - 107 107 - 108 108 - 111 112 113 - 117 118 - 120 121 121 - 123
Single Level Index Types of Single – Level Indexes Search Trees & B – Trees B+ – Trees Assignment 1 Assignment 2 Answer Keys Explanations
124 - 125 125 - 127 127 - 131 131 - 140 141 - 144 144 - 145 146 146 - 148
Test Questions Answer Keys Explanations
149 - 156 157 157 - 161
5.
6.
th
th
th
Chapter 1
DBMS
•
Collection of interrelated data
•
Set of programs to access the data
•
An environment that is both convenient and efficient to use
Describes how a record (e.g., customer) is stored.
Describes data stored in database, and the relationships among the data.
Application programs hide details of data types. Views can also hide information (such as an employee’s salary) for security purposes.
th
th
th
Chapter 1
DBMS
•
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.
•
Static Information Data -- Entities Associations -- Relationships among entities Dynamic Information Processes -- Operations/transactions Operations/transactions Integrity constraints -- Business rules/regulations and data meanings
A collection of tools for describing:data data relationships data semantics data constraints
A data model is a collection of concept that can be used to describe the structure of database.
The description of a database is called the database schema.
Data flow diagram (DFD) Hierarchical input process and output (HIPO) th
th
th
Chapter 1
DBMS
State transition diagrams (STD) Entity Relationship (ER) diagrams
A data model in which information stored in the database is viewed as sets of entities and sets of relationships among entities and it is diagram-based representation of domain knowledge, data properties etc...., but it is more intuitive and less mechanical. Entity – Relationship is a popular high-level conceptual data model.
Entity Set
E
Weak Entity Set
R
Relationship Set
R
Identifying Relationship Set for Weak Entity Set
A
A
Attribute
A
Multivated Attribute
A
Derived Attribute
R
Primary Key
Total participation of Entity Set in Rela Relati tion onsh shii Discriminating Attribute of Weak Entity Set
E
A
Fig. 1.1 a. Entity b. Relationship c. Attributes
The basic object that the ER model represents is an entity, which is a “thing” in the real world with an independent existence and is distinguishable Student entities with unique roll numbers Account entities with unique account numbers
th
th
th
Chapter 1
DBMS
Identify two entities that might be important for a retail business. Two entities for a business might include employee and customer.
A set of entities of the same type. All the student entities in a college Entity sets need not be disjoint. A person entity could be in both the customer and employee sets
Entities with physical existence Example Student, customer, book etc Entities with Conceptual existence Example: Sale, University course etc
An association among two or more entities. The relationship between a Faculty and Student i.e. faculty take course for student
A set of relationships of the same type
The particular properties of entity that describe it 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 - the attributes of the contained entities. The value of the attribute can be different for each entity in the set.
th
th
th
Chapter 1
•
Simple and Composite Attribute
•
Single Valued and Multi Valued attribute
•
Stored and Derived Attributes
DBMS
Simple attribute that consist of a single atomic value. A composite attribute is an attribute that can 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. Salary, age etc Composite Attribute : Attribute value not atomic. Address : ‘House_no: City: ‘House_no: City: State’ State’ Name
: ‘First Name: Middle Name: Last Name’
A 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 be simple or composite attribute. That is 'date of birth' is a composite attribute , 'age' is a simple attribute. But both are single valued attributes. Multivalued attributes can have multiple values. For instance a person may have multiple phone numbers, multiple degrees etc. Multivalued attributes are shown by a double line connecting to the entity in the ER diagram. Single Valued Attribute: Attribute that hold h old 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
The value for the derived attribute is derived from the stored attribute.
th
th
th
Chapter 1
DBMS
For example 'Date of birth' of a person is a stored attribute. The value for the attribute 'AGE' can be derived by subtracting the 'Date of Birth'(DOB) from the current date. Stored attribute supplies 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 that’s value is derived f rom a stored attribute. attribute. Example : Age and it’s value is derived from the stored attribute Date of Birth.
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.
Unary
Binary
Em lo ee
Work
Em lo ee
De artment De
Supervise n-ary
Ternary
ro ect ect
Supply
Part Part
Supplier Fig. 1.2
th
th
th