Module-1 Lecture Notes
Module-1 Lecture Notes
• Optimize a query.
• What is Data?
– Collection of raw facts.
– Facts that can be recorded and have implicit meaning, known as data.
– For ex: Students records- rno, name, address…
• Database
– Collection of interrelated data.
– Can be stored in the form of tables.
– Data can be stored, updated, deleted either manually or computerized.
Rno Name Address
101 Ajay Bhopal
102 Sahil Ujjain
Prepared and compiled by 6
Bhupendra Panchal, Asst. Professor, CSE
Introduction to Database Cont….:
– Primary goal of DBMS is to perform the operations for data without any
anomalies.
• User interface
Presentation Tier • View level
• Application server
& Programs
• Logics Application Tier • Query Processing
• Abstraction Language
• Relation of Data
Database Tier • Constrains
2. Conceptual Level
• The conceptual schema describes the design of a database at the conceptual level.
• Conceptual level is also known as logical level.
• The conceptual level describes what data are to be stored in the database and also describes
what relationship exists among those data.
• In this level, internal details such as an implementation of the data structure are hidden.
• Programmers and database administrators work at this level.
3. External Level
• The external level describes the different views of the database.
• An external schema is also known as view schema.
• Each view schema describes the database part that a particular user group is interested and
hides the remaining database from that user group.
• The view schema describes the end user interaction with database systems.
Prepared and compiled by
Bhupendra Panchal, Asst. Professor, CSE
Levels of Data Abstraction or View of Data:
Internal/Physical
How the Data is actually stored?
Level
Prepared and compiled by 13
Bhupendra Panchal, Asst. Professor, CSE
Data Independence:
Database Schemas:
• It is the description of Database (Overall design of Database).
• Specified during database design.
• Not expected to change frequently.
Database Instances:
• Collection of information stored in the database at particular
state of time.
• Snapshot of Database.
ROLL_NO NAME
-------------------- ------------------------------
CS101 Ajay
CS102 Aman
CS103 Amit
CS104
CS105 Anuj Prepared and compiled by 22
Bhupendra Panchal, Asst. Professor, CSE
Data Manipulation Language:
SQL> select * from student where address= 'Bhopal';
ROLL_NUMBER
--------------------
CS101
CS102
CS103
CS104
CS105 Prepared and compiled by 23
Bhupendra Panchal, Asst. Professor, CSE
Data Manipulation Language:
1 row deleted.
2 rows deleted.
28
Prepared and compiled by
Bhupendra Panchal, Asst. Professor, CSE
Prepared and compiled by
Bhupendra Panchal, Asst. Professor, CSE
Prepared and compiled by
Bhupendra Panchal, Asst. Professor, CSE
The Evolution of Data Models:
31
Prepared and compiled by
Bhupendra Panchal, Asst. Professor, CSE
The Entity Relationship Model
– Widely accepted and adapted graphical tool for data modeling.
– ER Model is a high-level conceptual data model diagram.
– ER model helps you to analyze data requirements to produce a
well-designed database.
– Graphical representation of entities and their relationships in a
database structure.
– In other words, ER diagrams help to explain the logical structure of
databases.
– Components of ER Model:
• Entity
• Relationship
• Attributes
32
Prepared and compiled by
Bhupendra Panchal, Asst. Professor, CSE
The Entity Relationship Model Example-
Relational diagram-
• Representation of relational database’s entities, attributes within those
entities, and relationships between those entities.
Advantages
• Many of the hierarchical data model’s features formed the foundation
for current data models.
• Its database application advantages are replicated in current database
environments.
Disadvantages
• Complex to implement
• Difficult to manage
• Implementation limitations
– Components of ER Model:
• Entity
• Relationship
43
• Attributes
Prepared and compiled by
Bhupendra Panchal, Asst. Professor, CSE
Components in ER Model:
44
DOB
Phone_No
Student
DOB
Student
Here each loan entity is associated with at least one associated customer.
Worker
Work
Employee For
Manager
Aggregation:
Generalization
Prepared and compiled by
Bhupendra Panchal, Asst. Professor, CSE 71
Specialization in ER Diagram:
Specialization
Prepared and compiled by
Bhupendra Panchal, Asst. Professor, CSE 72
Specialization & Generalization in ER Diagram:
Generalization
Specialization
Employee
Eid Name Salary
1201 Aman 56,000
1202 Prateek 49,000
1203 Bhavya 52,000
Employee
Eid Name Basic HRA TA DA
1201 Aman 32000 3000 1500 4500
1202 Prateek 29000 3000 1500 4500
1203 Bhavya 30000 3000 1500 4500
Employee Employee
Eid Name Salary Eid City
1201 Aman 56,000 1201 Indore
1202 Prateek 49,000 1201 Bhopal
1203 Bhavya 52,000 1202 Indore
1203 Bhopal
Prepared and compiled by
Bhupendra Panchal, Asst. Professor, CSE
Conversion of ER Model into Relational Model
4. Translating Relationship set into Relations:
Department
Did Dname Eid
D01 HR 1202
D02 Admin 1202
D03 Finance 1203
Prepared and compiled by 80
Bhupendra Panchal, Asst. Professor, CSE
Conversion of ER Model into Relational Model
Find the minimum no. of tables that are possible for converting
into ER Model
Find the minimum no. of tables that are possible for converting
into ER Model
87