Académique Documents
Professionnel Documents
Culture Documents
Ans :-
Database systems are made-up of complex data structures. To ease the user
interaction with database, the developers hide internal irrelevant details from
users. This process of hiding irrelevant details from user is called data
abstraction.
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.
type customer = record
customer_id : string;
customer_name : string;
customer_street : string;
customer_city : string;
end;
View level: application programs hide details of data types. Views can
also hide information (such as an employee’s salary) for security
purposes.
Database System Concepts - 5th Edition, May 23, 2005 1.6 ©Silberschatz, Korth and Sudarshan
View of Data
Database System Concepts - 5th Edition, May 23, 2005 1.7 ©Silberschatz, Korth and Sudarshan
What do you mean by Data modelling ? Discuss different types of data modelling.?
Ans :-
Database design is defined as: "design the logical and physical structure of one or more databases to
accommodate the information needs of the users in an organization for a defined set of applications".
The design process roughly follows five steps:
1. Planning and analysis
2. Conceptual design
3. Logical design
4. Physical design
5. Implementation
The data model is one part of the conceptual design process. The other, typically is the functional
model. The data model focuses on what data should be stored in the database while the functional
model deals with how the data is processed. To put this in the context of the relational database,
the data model is used to design the relational tables. The functional model is used to design the
queries which will access and perform operations on those tables.
Data Model
A data model is a collection of conceptual tools for describing data, data relationships,
data semantics, and consistency constraints.
Some of the most popular data models are explained below:
Relational Model
Attributes
Example of tabular data in the relational model
Database System Concepts - 5th Edition, May 23, 2005 1.12 ©Silberschatz, Korth and Sudarshan
The Entity-Relationship Model
Models an enterprise as a collection of entities and relationships
Entity: a “thing” or “object” in the enterprise that is distinguishable
from other objects
Described by a set of attributes
Relationship: an association among several entities
Represented diagrammatically by an entity-relationship diagram:
Database System Concepts - 5th Edition, May 23, 2005 1.16 ©Silberschatz, Korth and Sudarshan
On the other hand, a file system is a A database is generally used for storing related,
more unstructured data store for storing structured data, with well defined data formats, in an
arbitrary, probably unrelated data. efficient manner for insert, update and/or retrieval.
A file system provides much looser While databases are consistent at any instant in
guarantees about consistency, isolation time,provide,isolated transactions and durable writes,
and durability.
1. Logical data independence is the capacity to change the conceptual schema without having to
change external schemas or application programs. We may change the conceptual schema to
expand the database (by adding a record type or data item), or to reduce the database (by
removing a record type or data item). In the latter case, external schemas that refer only to the
remaining data should not be affected. Only the view definition and the mappings need be
changed in a DBMS that supports logical data independence. Application programs that reference
the external schema constructs must work as before, after the conceptual schema undergoes a
logical reorganization. Changes to constraints can be applied also to the conceptual schema
without affecting the external schemas or application programs.
2. Physical data independence is the capacity to change the internal schema without having to
change the conceptual (or external) schemas. Changes to the internal schema may be needed
because some physical files had to be reorganized—for example, by creating additional access
structures—to improve the performance of retrieval or update. If the same data as before remains
in the database, we should not have to change the conceptual schema.
Whenever we have a multiple-level DBMS, its catalog must be expanded to include information
on how to map requests and data among the various levels. The DBMS uses additional software
to accomplish these mappings by referring to the mapping information in the catalog. Data
independence is accomplished because, when the schema is changed at some level, the schema at
the next higher level remains unchanged; only the mapping between the two levels is changed.
Hence, application programs referring to the higher-level schema need not be changed.
The three-schema architecture can make it easier to achieve true data independence, both
physical and logical. However, the two levels of mappings create an overhead during
compilation or execution of a query or program, leading to inefficiencies in the DBMS. Because
of this, few DBMSs have implemented the full three-schema architecture.
Design an ER diagram for banking enterprise and convert it into relational model ?
ER Diagram:
Relational Model:
Entities
Discuss different types of attributes with suitable example ?
What is an Attribute and it’s types with Examples: Generally attribute
constitutes a character and explains the characteristics of an entity. In database
management system (DBMS) it assigns a database component or database field.
Attribute stores or saves only a piece of data. For example, in an invoice the attribute
may be the price or date. In this article, we will discuss the various types of attributes
with examples.
Also See: What is Database Management System
Examples
Another example: consider the entity student and it has the attribute like student-
Lname, student- Fname, student-Email, student-phone and many. This entity can be
represented in two models, they are
Chen model
Crow’s foot model
In Chen model, attributes are represented by ovals and where as the entity is by a
rectangle. These two are connected to each other by a line.
Chen
Model
In Crow’s foot model, attributes are portrayed in a rectangle box; below the entity box.
Crow Model
Types of Attributes with Examples
The different types of attributes are as follows
Example: Any manufactured product can have only one serial no. , but the single valued
attribute cannot be simple valued attribute because it can be subdivided. Likewise in the
above example the serial no. can be subdivided on the basis of region, part no. etc.
Multi Valued Attributes: These are the attributes which can have multiple values for
a single or same entity.
Example: Car’s colors can be divided into many colors like for roof, trim.
The notation for multi valued attribute is:
Example: Entity Employee Name can be divided into sub divisions like FName, MName,
LName.
Example: The entities like age, marital status cannot be subdivided and are simple
attributes.
Stored Attributes: Attribute that cannot be derived from other attributes are called as
stored attributes.
Derived Attributes: These attributes are derived from other attributes. It can be
derived from multiple attributes and also from a separate table.
Example: Today’s date and age can be derived. Age can be derived by the difference
between current date and date of birth.
The notation for the derived attribute is:
Fig 6: Notation of derived attribute
Complex Attributes: For an entity, if an attribute is made using the multi valued
attributes and composite attributes then it is known as complex attributes.
Example: A person can have more than one residence; each residence can have more
than one phone.
Key Attributes: This attribute represents the main characteristic of an entity i.e.
primary key. Key attribute has clearly different value for each element in an entity set.
Example: The entity student ID is a key attribute because no other student will have the
same ID.
Example: Taking the example of a college, there the student’s name is a vital thing.
Example: Considering the entity student there the student’s middle name and the email
ID is optional.
Password
Security_quest
Passenger
PNR Primary Key
P_name
Age
Gender
Seat_no.
Reserve_status
Train_Status
Wait_seat
Status_id Primary Key
Avail_seat
Booked_seat
Train
T_name
Train_type
Avail_class
Route
Arr_time
Depart_time
Stop no.
Station
Station_name
First_Name
First_Name
Middle_Name
Last_name
Reserve_status
Waiting
Confirmed
U_id Passenger table makes foreign key references to U_id of User table.
U_id Passenger table makes foreign key references to U_id of User table.
Status_id Passenger table makes foreign key references to Status_id of Train_Status Table.
Train_id Passenger table makes foreign key references to Train_id of Train Table
Train_Status
Train_id Train_status table makes foreign key references to Train_id of Train Table
PNR Train_status table makes foreign key references to PNR of Passenger table.
Train
Route
Station_id Route table makes foreign key references to Station_id of Station table.
Train_id Route table makes foreign key references to Train_id of Train Table
Specialization –
In specialization, an entity is divided into sub-entities based on their characteristics. It is
a top-down approach where higher level entity is specialized into two or more lower
level entities. For Example, EMPLOYEE entity in an Employee management system
can be specialized into DEVELOPER, TESTER etc. as shown in Figure 2. In this case,
common attributes like E_NAME, E_SAL etc. become part of higher entity
(EMPLOYEE) and specialized attributes like TES_TYPE become part of specialized
entity (TESTER).
10) Write short note on -> 1) Total Participation 2) Partial Participation 3)Storage Manager and Query
processor. ?
where F1, F2, ..., Fn are functions over the attributes in relation R and may involve
arithmetic operations and constant values. This operation is helpful when developing
reports where computed values have to be produced in the columns of a query
result.
As an example, consider the relation
EMPLOYEE (Ssn, Salary, Deduction, Years_service)
A report may be required to show
Net Salary = Salary – Deduction,
Bonus = 2000 * Years_service, and
Tax = 0.25 * Salary.
Then a generalized projection combined with renaming may be used as follows:
REPORT (Ssn, Net_salary, Bonus, Tax)(Ssn, Salary – Deduction, 2000 * Years_service,
0.25 * Salary(EMPLOYEE)
Simplicity
The relational model structures data in a manner that avoids complexity. The table
structure is an intuitive organization familiar to most users, particularly those who have
worked with physical or software spreadsheets, check registers or other tabular data.
Data are organized naturally within the model, simplifying the development and use of
the database.
Ease of Data Retrieval
Under the relational model, accessing data in a database does not require navigating a
rigid pathway through a tree or hierarchy. Users can query any table in the database,
and combine related tables using special join functions to include relevant data
contained in other tables in the results. Results can be filtered based on the content of
any column, and on any number of columns, allowing users to easily retrieve
meaningful results. Users can choose which columns to include in the results so that
only relevant data are displayed.
Data Integrity
Data integrity is an essential feature of the relational model. Strong data typing and
validity checks ensure data fall within acceptable ranges, and required data are present.
Referential integrity among tables prevents records from becoming incomplete or
orphaned. Data integrity helps to ensure accuracy and consistency of the data.
Flexibility
The relational database model is naturally scalable and extensible, providing a flexible
structure to meet changing requirements and increasing amounts of data. The relational
model permits changes to a database structure to be implemented easily without
impacting the data or the rest of the database. The database analyst can quickly and
easily add, remove, and modify tables and columns in an existing database to meet
business requirements. There is theoretically no limit on the number of rows, columns or
tables. In reality, growth and change are limited by the relational database management
system and physical computing hardware, and changes may impact external
applications designed for a specific database structure.
Normalization