Database chapter 2 lecture note
Database chapter 2 lecture note
Chapter Two
2. Database System Concepts and Architecture
One fundamental characteristic of the database approach is that it provides some level of data
abstraction by hiding details of data storage that are not needed by most database users.
❖ A data model-a collection of concepts that can be used to describe the structure of a
database-provides the necessary means to achieve this abstraction.
❖ It is a description of the way that data is stored in a database. Data model helps to
understand the relationship between entities and to create the most effective structure to
hold data.
❖ It also set of concepts to describe the structure of a database, and certain constraints that
the database should obey.
Data Model is a collection of tools or concepts for describing
➢ Data
➢ Data relationships
➢ Data semantics
➢ Data constraints
Data Model Structure and Constraints:
o Data Model constructs define the database structure
o Data model constructs often include: data elements and their data types
(often called attributes); grouping of related elements into entities (also
called objects or records or tuples); and relationships among entities
o Constraints specify restrictions on the stored data; the data that satisfies
the constraints is called valid data
Data Model Operations:
o These operations are used for specifying database retrievals and updates
by referring to the constructs of the data model.
o Operations on the data model may include basic model operations (e.g.
generic insert, delete, update) and user-defined operations (e.g.
compute_student_gpa, update_inventory
The main purpose of Data Model is to represent the data in an understandable way. Categories of
data models include:
❖ Object-based
❖ Record-based
❖ Physical
Record-based Data Models
✓ Consist of a number of fixed format records.
✓ Each record type defines a fixed number of fields,
✓ Each field is typically of a fixed length.
ADVANTAGES:
✓ Hierarchical Model is simple to construct and operate on
✓ Corresponds to a number of natural hierarchically organized domains - e.g.,
assemblies in manufacturing, personnel organization in companies
✓ Language is simple; uses constructs like GET, GET UNIQUE, GET NEXT, GET
NEXT WITHIN PARENT etc.
DISADVANTAGES:
❖ Navigational and procedural nature of processing
❖ Database is visualized as a linear arrangement of records
❖ Little scope for "query optimization"
2. Network Model
➢ Allows record types to have more than one parent unlike hierarchical model
➢ A network data models sees records as set members
➢ Each set has an owner and one or more members
➢ Allow no many to many relationship between entities
➢ Like hierarchical model network model is a collection of physically linked
records.
➢ Allow member records to have more than one owner
ADVANTAGES:
Network Model is able to model complex relationships and represents semantics of
add/delete on the relationships.
Can handle most situations for modeling using record types and relationship types.
Language is navigational; uses constructs like FIND, FIND member, FIND owner, FIND
NEXT within set, GET etc. Programmers can do optimal navigation through the
database.
DISADVANTAGES:
Navigational and procedural nature of processing
Database contains a complex array of pointers that thread through a set of records.
Little scope for automated "query optimization”
3. Relational Data Model
➢ Developed by Dr. Edgar Frank Codd in 1970 (famous paper, 'A Relational Model
for Large Shared Data Banks')
➢ Terminologies originates from the branch of mathematics called set theory and
predicate logic and is based on the mathematica l concept called Relation
➢ Can define more flexible and complex relationship
➢ Viewed as a collection of tables called “Relations” equivalent to collection of
record types
➢ Relation: Two dimensional table
➢ Stores information or data in the form of tables rows and columns
➢ A row of the table is called tuple equivalent to record
➢ A column of a table is called attribute equivalent to fields
➢ Data value is the value of the Attribute
➢ Records are related by the data stored jointly in the fields of records in two tables
or files. The related tables contain information that creates the relation
level of a database system without having to change the schema at the next higher
level. We can define two types of data independence:
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.
➢ Non-Procedural DML: user specifies what data is required but not how it is to be
retrieved.
Data control language (DCL)
Is a syntax similar to a computer programming language used to control access to data
stored in a database.
In particular, it is a component of Structured query language (SQL).
Examples of DCL commands include:
GRANT: to allow specified users to perform specified tasks.
REVOKE: to cancel previously granted or denied permissions.
The operations for which privileges may be granted to or revoked from a user or role may
include: CONNECT, SELECT, INSERT, UPDATE, DELETE, EXECUTE, and USAGE.
In the Oracle database, executing a DCL command issues an implicit commit.
Hence you cannot roll back the command.
This interface consist of forms which are adapted to the user. He/She can fill in all of the
fields and make new entries to the database or only some of the fields to query the other
ones.
❖ Graphics-based (Point and Click, Drag and Drop etc.)