0% found this document useful (0 votes)
45 views

Database System Concepts & Architecture - Conceptual Data Modeling and Database Design

The document discusses database system concepts and architecture. It covers data models and their categories including high-level, representational, and low-level models. It also discusses schemas, instances, states, levels of abstraction, data independence, and classifications of database management systems. Conceptual data modeling and database design are also introduced.

Uploaded by

Yohannes Asfaw
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

Database System Concepts & Architecture - Conceptual Data Modeling and Database Design

The document discusses database system concepts and architecture. It covers data models and their categories including high-level, representational, and low-level models. It also discusses schemas, instances, states, levels of abstraction, data independence, and classifications of database management systems. Conceptual data modeling and database design are also introduced.

Uploaded by

Yohannes Asfaw
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 46

Lecture 2

• Database system concepts & Architecture


• Conceptual Data modeling and Database Design

Fundamentals of Database
DATABASE SYSTEM CONCEPTS & ARCHITECTURE

Data model and their categories

Schemas, Instances and states

Level of Abstraction

Data Independence and Classification of DBMS

Fundamentals of Database
CONT’D…

 Data model: a collection of concepts that can be used to describe the structure of a database.

 Structure of Database : data types, relationships, and constraints

 Basic operations

 Categories of data model

1. High-level or Conceptual data models: provide concepts that are close to the way many users
perceive data: uses

 Entities

 Attributes

 Relationships

Fundamentals of Database
CONT’D…

2. Representational or implementation data models: which provide concepts that


may be easily understood by end users

 widely used relational data model, constraints, operations and languages (standard
SQL).

3. Low-level or Physical data models: provide concepts that describe the details
of how data is stored on the computer storage media. (computer specialists, not for
end users)

 record formats, record orderings, and access paths (search by Index or Key word)

Fundamentals of Database
CONT’D…

Schema

Description of a database is called the database schema, which is


specified during database design and is not expected to change frequently.

A displayed schema is called a schema diagram

Fundamentals of Database
CONT’D…

schema diagram

Fundamentals of Database
RELATION SCHEMA

The Schema (or description) of a Relation:


 Denoted by R(A1, A2, .....An)

 R is the name of the relation

 The attributes of the relation are A1, A2, ..., An

Example:

CUSTOMER (Cust-id, Cust-name, Address, Phone#)


 CUSTOMER is the relation name

 Defined over the four attributes: Cust-id, Cust-name, Address, Phone#

Fundamentals of Database
 In a given database state, each schema construct has its own current set of instances; for
example, the STUDENT construct will contain the set of individual student entities
(records) as its instances.

 Valid state is a state that satisfies the structure and constraints of DB

Fundamentals of Database
THE THREE LEVEL OF ABSTRACTION (THE
THREE-SCHEMA ARCHITECTURE)
CONT’D…
Goal: separate the user application from physical database

1. Internal level: describes detail physical storage structure of the DB.

2. Conceptual level: hides the detail of physical storage structure and focus on describing entities,
data type etc. what data is stored

3. External level: describes the part of the DB that the user interested in and hide the rest of the
database from the user group.

Fundamentals of Database
CONT’D…
Data Independence:

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. (expand by
adding data item, reduce)
2. Physical data independence: is the capacity to change the internal schema
without having to change the conceptual schema
For example, by creating additional access structures - to improve the performance
of retrieval or update.
Fundamentals of Database
CONT’D…

Classification of DBMSs

We can classify DBMS based on different criterion


 Based on which data model used

 number of users supported by the system (single user vs multi user)

 number of sites over which the database is distributed.(centralized vs distributed)

Fundamentals of Database
READING ASSIGNMENT

• Database system environment


• Centralized and client-server Architecture
• XML Data model which is standard for exchanging data over the Web
Chapter 2

Conceptual Data modeling and Database Design

Fundamentals of Database
OUTLINE

Basic concepts:
 Relation

 Entity, attributes

constraints

ER Model Concepts

ER Diagrams - Notations

Fundamentals of Database, Chapter 1


CONT’D…

Informally, a relation looks like a table of values.

A relation typically contains a set of rows.

The data elements in each row represent certain facts that correspond to a real-world entity or
relationship

In the formal model, rows are called tuples

 Entity: represents a real-world object or concept

 Relationships: among two or more entities represents an association among the entities.

Each column has a column header that gives an indication of the meaning of the data items
 In the formal model, the column header is called an attribute name (or just attribute)

 Attributes : represents some property of interest that further describes an entity.

Fundamentals of Database
EXAMPLES OF A RELATION

Fundamentals of Database
CONT’D…

Each attribute has a domain or a set of valid values.


 For example, the domain of Cust-id is 6 digit numbers

A tuple is an ordered set of values (enclosed in angled brackets ‘< … >’)

Each value is derived from an appropriate domain.

A row in the CUSTOMER relation is a 4-tuple and would consist of four values, for example:
 <“632895”, "John Smith", "101 Main St. Atlanta, GA 30332", "(404) 894-2000">

 This is called a 4-tuple as it has 4 values

Fundamentals of Database
CONT’D…

A domain D Examples:

• Usa_phone_numbers. The set of ten-digit phone numbers valid in the United


States.

• Grade_point_averages. Possible values of computed grade point averages; each


must be a real (floating-point) number between 0 and 4.

• Student_ages: Greater than 18

• Employee_age: Possible ages of employees in a company; each must be an


integer value between 15 and 80.
Fundamentals of Database
CONT’D…


A domain has a logical definition:


Example: “USA_phone_numbers” are the set of 10 digit phone numbers valid in the U.S.


A domain also has a data-type or a format defined for it.


The USA_phone_numbers may have a format: (ddd)ddd-dddd where each d is a decimal digit.


Dates have various formats such as year, month, date formatted as yyyy-mm-dd, or as dd

mm,yyyy etc.

Fundamentals of Database
PROPERTIES OF RELATIONS

 Tuple in a relation do not have any particular order

 Each value in a tuple is an atomic value; that is, it is not divisible into
components within the framework of the basic relational model. Hence,
composite and multi value attributes are not allowed

 NULL values, which are used to represent the values of attributes that may be
unknown or may not apply to a tuple.

Fundamentals of Database
RELATIONAL MODEL CONSTRAINTS

Constraints are conditions that must hold on all valid relation states.

There are three main types of constraints in the relational model:


 Key constraints

 Entity integrity constraints

 Referential integrity constraints

Another implicit constraint is the domain constraint


 Every value in a tuple must be from the domain of its attribute (or it could be null, if allowed for that
attribute)

Fundamentals of Database
KEY
CONSTRAINTS

 All tuple in a relation must be distinct. This means that no two tuple can have the
same combination of values for all their attributes

 Suppose that we denote one subset of attributes by SK; then for any two distinct
tuple t1 and t2 in a relation state r of R, we have the constraint that:
t1[SK]≠t2[SK]

 Any such set of attributes SK is called a super key of the relation schema R

Fundamentals of Database
CONT’D…

 A super key SK specifies a uniqueness constraint that no two distinct tuples in any
state r of R can have the same value for SK.

 A super key can have redundant attributes, however, so a more useful concept is
that of a key, which has no redundancy

 key satisfies two properties:

1. Two distinct tuples in any state of the relation cannot have identical values for
(all) the attributes in the key. This first property also applies to a super key.

Fundamentals of Database
CONT’D…

2. It is a minimal super key—that is, a super key from which we cannot remove any
attributes and still have the uniqueness constraint in condition 1 hold. This property
is not required by a super key. Hence a key is also a super key but not vice versa.
Consider the STUDENT relation .

The attribute set {Ssn} is a key of STUDENT because no two student tuples can
have the same value for Ssn. Any set of attributes that includes Ssn—for example,
{Ssn,Name,Age}—is a super key

Fundamentals of Database
CONT’D…

 The value of a key attribute can be used to identify uniquely each tuple in the relation.
For example, the Ssn value 305-61-2435 identifies uniquely the tuple corresponding to
Benjamin Bayer in the STUDENT relation

 a relation schema may have more than one key. In this case, each of the keys is called a
candidate key. For example, the CAR relation has two candidate keys: License_number
and Engine_serial_number.

 It is common to designate one of the candidate keys as the primary key of the relation.

Fundamentals of Database
CONT’D…

Notice that when a relation schema has several candidate keys, the choice of one to
become the primary key is somewhat arbitrary; however, it is usually better to choose
a primary key with a single attribute or a small number of attributes. The other
candidate keys are designated as unique keys, and are not underlined.

Fundamentals of Database
ENTITY INTEGRITY
CONSTRAINT

 The entity integrity constraint states that no primary key value can be NULL. This
is because the primary key value is used to identify individual tuple in a relation.
Having NULL values for the primary key implies that we cannot identify some tuple

 Key constraints and entity integrity constraints are specified on individual


relations

Fundamentals of Database
REFERENTIAL INTEGRITY
CONSTRAINT

 The referential integrity constraint is specified between two relations and is used to maintain the consistency among
tuple in the two relations.

 Informally, the referential integrity constraint states that a tuple in one relation that refers to another relation must refer to
an existing tuple in that relation.

Foreign key

 The conditions for a foreign key, given below , specify a referential integrity constraint between the two relation schemas
R1 and R2.

 A set of attributes FK in relation schema R1 is a foreign key of R1 that references relation R2 if it satisfies the following
rules:

Fundamentals of Database
CONT’D…
1. The attributes in FK have the same domain(s) as the primary key attributes PK of R2; the
attributes FK are said to reference or refer to the relation R2.

2. A value of FK in a tuple t1 of the current state r1(R1) either occurs as a value of PK for
some tuple t2 in the current state r2(R2) or is NULL.

In the former case, we have t1[FK] = t2[PK], and we say that the tuple t1 references or
refers to the tuple t2.

In this definition,R1 is called the referencing relation and R2 is the referenced relation. If
these two conditions hold, a referential integrity constraint from R1 to R2 is said to hold.

Fundamentals of Database
CONT’D…
• Draw relational database schema that we call
COMPANY = {EMPLOYEE, DEPARTMENT, DEPT_LOCATIONS, PROJECT}

• EMPLOYEE (A1,A2… An)


• DEPARTMENT,
• DEPT_LOCATIONS,
• PROJECT,

Fundamentals of Database
CONT’D…
• Draw relational database schema that we call COMPANY = {EMPLOYEE, DEPARTMENT,
DEPT_LOCATIONS, PROJECT, WORKS_ON, DEPENDENT}
• EMPLOYEE (A1,A2… An)
• DEPARTMENT,
• DEPT_LOCATIONS,
• PROJECT,
• WORKS_ON,
• DEPENDENT

Fundamentals of Database
CONT’D…

 All the above constraint also called state constraints because they define the constraints that a valid
state of the database must satisfy.

Fundamentals of Database
RELATIONAL DATABASES AND RELATIONAL DATABASE SCHEMAS

 The definitions and constraints we have discussed so far apply to single relations and
their attributes.

 A relational database schema S is a set of relation schemas S = {R1,R2,...,Rm} and a set


of integrity constraints IC.

Fundamentals of Database
CONT’D…
 A database state that does not obey all the integrity constraints is called an invalid
state, and a state that satisfies all the constraints in the defined set of integrity
constraints IC is called a valid state.

 Each relational DBMS must have a data definition language (DDL) for defining a
relational database schema.

 Current relational DBMSs are mostly using SQL for this purpose

Fundamentals of Database
UPDATE OPERATIONS AND CONSTRAINT VIOLATION

 The operations of the relational model can be categorized into retrievals and
updates

 The three basic operations that can change the states of relations in the
database: Insert, Delete, and Update (or Modify). They insert new data,
delete old data, or modify existing data records

 Whenever these operations are applied, the integrity constraints specified on


the relational database schema should not be violated.

Fundamentals of Database
CONT’D…

The Insert Operation

 The Insert operation provides a list of attribute values for a new tuple t that is to be inserted
into a relation R

Insert can violate any of the four types of constraints discussed in the previous section.

Domain constraints can be violated if an attribute value is given that does not appear in the
corresponding domain or is not of the appropriate data type.

Key constraints can be violated if a key value in the new tuple t already exists in another tuple
in the relation r(R).

Entity integrity can be violated if any part of the primary key of the new tuple t is NULL.

Fundamentals of Database
CONT’D…


Referential integrity: It can be violated if the value of any foreign key in t refers

to a tuple that does not exist in the referenced relation.


Operation:
Insert <‘Cecilia’,‘F’,‘Kolonsky’, NULL,‘1960-04-05’,‘6357WindyLane, Katy, TX’,F,28000,NULL,4> into
EMPLOYEE.
Result: This insertion violates the entity integrity constraint (NULL for the primary key Ssn),so it is rejected.
Operation:
Insert<‘Alicia’,‘J’,‘Zelaya’,‘999887777’,‘1960-04-05’,‘6357WindyLane,Katy, TX’,F,28000,‘987654321’,4>
into EMPLOYEE.
Result: This insertion violates the key constraint because another tuple with the same Ssn value already exists
in the EMPLOYEE relation, and so it is rejected.
Fundamentals of Database
CONT’D…

Operation: Insert <‘Cecilia’, ‘F’, ‘Kolonsky’, ‘677678989’, ‘1960-04-05’, ‘6357 Windswept,


Katy,TX’,F,28000,‘987654321’,7> into EMPLOYEE.

Result: This insertion violates the referential integrity constraint specified on Dno in EMPLOYEE
because no corresponding referenced tuple exists in DEPARTMENT with Dnumber = 7

Operation: Insert <‘Cecilia’,‘F’,‘Kolonsky’,‘677678989’,‘1960-04-05’,‘6357 Windy Lane,


Katy,TX’,F,28000,NULL,4> into EMPLOYEE.

Result: This insertion satisfies all constraints, so it is acceptable.

 If an insertion violates one or more constraints, the default option is to reject the insertion and
correctly input again.

Fundamentals of Database
DELETION OPERATION
The Delete operation can violate only referential integrity

 This occurs if the tuple being deleted is referenced by foreign keys from other tuple in the
database

Operation

Delete the WORKS_ON tuple with Essn = ‘999887777’and Pno = 10.

 Result: This deletion is acceptable and deletes exactly one tuple.

Operation: Delete the EMPLOYEE tuple with Ssn = ‘999887777’.

 Result: This deletion is not acceptable, because there are tuple in WORKS_ON that refer to this
tuple. Hence, if the tuple in EMPLOYEE is deleted, referential integrity violations will result.

Fundamentals of Database
CONT’D…

Update Operation

Updating an attribute that is neither part of a primary key nor of a foreign key
usually causes no problems; the DBMS need only check to confirm that the new
value is the correct data type and domain.

Fundamentals of Database
RELATIONAL DBMS

 RDBMS stands for Relational Database Management System.

 RDBMS is the basis for SQL, the data in RDBMS is stored in database objects called tables .

 Current popular relational DBMSs (RDBMSs) includes

 IBM DB2 (from IBM),

 Oracle (from Oracle),

 Sybase DBMS (from Sybase) and

 SQL Server and

 Access (from Microsoft).

 In addition, several open source systems, such as My SQL and Postgre SQL,are available

Fundamentals of Database

You might also like