0% found this document useful (0 votes)
9 views33 pages

Chapter 1

The document provides an introduction to database design and databases. It discusses definitions of databases, data modeling, relational databases, querying relational databases, transaction management, and components of database systems.

Uploaded by

nonstres095
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views33 pages

Chapter 1

The document provides an introduction to database design and databases. It discusses definitions of databases, data modeling, relational databases, querying relational databases, transaction management, and components of database systems.

Uploaded by

nonstres095
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

DATABASES

1. Introduction to Database Design

[email protected]
Course Content

• Introduction
• Definitions
• Classifications

• Data Modelling
• Relational Databases
• Querying Relational Databases
• Development of Relational Database Systems
• Database Development
• Database Application Development

• Transaction Management
Bibliography

• F. Ionescu, “Baze de date relationale si aplicatii”, Ed. Tehnica, Bucureşti, 2004


• C. J. Date, “An Introduction to Database Systems”, 8th Edition, 2004
• R. Elmasri, S. B. Navathe, “Fundamentals of Database Systems”, 6th Edition, 2010
• J. Ullman, J. Windom, “A First Course In Database Systems”, 3rd Edition, 2007
• Kevin Kline, Daniel Kline, “ SQL In A Nutshell”, 3rd Edition, 2008
• MySQL Documentation - https://dev.mysql.com/doc/
• PostgreSQL Documentation - https://postgresql.org/docs/
• MS SQL Server Documentation - https://docs.microsoft.com/sql/sql-server/
Chapter 1. Introduction

• Definitions
• Components of a database system
• Internal architecture of database systems
• Advantages of database systems
• Classification of database systems
• Data modelling
• Evolution of database systems
Definitions

• Databases are used in almost all areas of activity:


• Banking and commercial activities
• Bank deposits
• Product sales
• Production
• Inventory management
• Payroll
• Population records, tax information
• Services
• Medical
• Travel
• Education
• Etc.
Definitions

• Definition (broad sense): A database is a logically correlated


collection of data that reflects (models) a particular aspect of the
real world and is intended for a particular group of users.
• In this sense, the following can be considered “databases”:
• Record sheets (manually maintained)
• Document files or spreadsheets (Word, Excel)

• Definition (in a narrow sense, current): A database is a


computerized data collection which allows operations of:
• Insert
• Update
• Delete
• Query
Components of a database system

• A database system is a computerized system for keeping records of


a particular activity
• The components of a database system are: hardware, software,
users and persistent data
• Hardware:
• Database systems are installed on general purpose computers
• Databases are physically stored as files on storage media (hard disks)
• The size and performance of the database depend on the computing system on
which it is installed
Components of a database system

• Software:
• Operating systems, libraries, development tools, interfaces
• Database Management System ( DBMS) - receives user requests for access to
the database, interprets them, executes the corresponding operations and
returns the result
• Database Applications - programs that create and use databases
Components of a database system

• Users:
• Database administrator
• Analysts and designers of databases
• Application developers
• End users
Components of a database system

• Conceptual languages for working with databases:


• Data Definition Language – DDL
• Data Manipulation Language – DML
• Data Control Language – DCL
• Transaction Control Language – TCL
Internal architecture of a database system

• Architecture on 3 relatively independent levels (ANSI/X3/SPARC


standard -1975):
• Internal level
• Describes the physical storage structure of the database. This level is built upon
physical records
• Conceptual level
• Describes the structure of the whole database for the complete community of users.
This level describes the representation of the entire information content of the
database
• External level
• Describes part of the database of interest for a particular user group
Internal architecture of a database system
Advantages of database systems

• Main advantages:
• High data compaction
• High speed for DML operations (insert, update, delete)
• Representing complex associations between data
• Controlled (and lower) data redundancy
• Independence of data over the hardware used
• Data security: user authentication and access authorization
• Integrity restrictions (constraints) on inserting and updating data
• Maintaining the integrity of data in case of failures: rescue and restoration
• Possibility to share data among several types of users with concurrent access
Classification of database systems

• Classification by data model


• Hierarchical data model
• Network data model
• Relational model
• Object-oriented model
• Object-relational model

• Classification by number of users


• Mono/multi-user systems

• Classification by the number of stations


• Centralized databases
• Distributed databases
Data modeling

• A model is an abstraction of a system:


• Captures the most important features of the system (concepts)
• The concepts must be relevant to the purpose for which they are defined

• The technique of identifying the essential characteristics of a system


is called abstraction
• A data model sets out the rules for organizing and interpreting a
collection of data and is represented by:
• Sets of entities
• Associations between sets of entities
Data modeling

• High level conceptual models (Entity-Relationship model,


Enhanced Entity-Relationship model) briefly describe the sets of
entities and their associations
• They do not specify how the data is structured or processed
• They are represented by a high level conceptual scheme
• Data structuring models (hierarchical model, network model,
relational model, etc.) describe the representation of sets of entities
and their associations through certain data structures (trees,
graphs, tables)
Entity-Relationship model

• The Entity-Relationship (ER) model (introduced in 1976) defines


sets of entities and their associations, but does not impose a specific
way of structuring and processing data
• An entity is “whatever exists in the objective reality and can be
distinctively identified”
• Examples: a person, a product, an activity, a course, etc.

• An attribute is a property that describes a particular aspect of an


entity
• Examples: a person has a first name, last name, address, etc.
Entity-Relationship model

• An entity type refers to similar entities that can be described by the


same attributes:
• Examples: person type, product type, etc.

• Entities sets represent collections of all entities of the same type in a


database:
• Examples: the crowd of all people, the catalog of all products, etc.

• An entity can be described as an instance of an entity type


• The previous definitions have a similarity with the object-oriented
model: entity type – class, entity – object
Relationships (Associations)

• A relationship (association) is a correspondence between entities in


two or more entity sets. Associations can have attributes
• The degree (type) of an association is the number of sets of
associated entities:
• Binary (between 2 sets of entities) – most associations
• Multiple (between k sets of entities, where k > 2)

• Types of binary associations (by number of elements in each set):


• 1:1 (one-to-one): person – id card
• 1:M (one-to-many): product – comments
• M:1 (many-to-one): comments – product
• M:M (many-to-many): products – categories
Relationships (Associations) – 1:1
Relationships (Associations) – 1:M
Relationships (Associations) – M:1
Relationships (Associations) – M:M
Cardinality of associations

• Cardinality (multiplicity) of a set of entities is the maximum


number of elements in that set that can be associated with an
element in another set
• Example: The one-to-many relationship between sets A and B shows the
cardinality 1 for set A and M (with M ≥ 1) for set B

• Cardinality ratio is the ratio of the values of the cardinality on two


associated sets of entities:
• Binary associations (1:1, 1:M, M:1, M:M)
• Multiple associations have a cardinality ratio for each pair of sets of entities in
the relationship
Entity-Relationship (ER) Diagram

• The Entity-Relationship (ER) Diagram represents the Entity-


Relationship model graphically, through a set of entities and their
associations
• Symbols (notations):
Entity-Relationship (ER) Diagram
Entity-Relationship (ER) Diagram

• Strong entities
• CUSTOMERS (Username, First name, Last name, Email, etc.)
• CATEGORIES (Name)
• PRODUCTS (Name, Price, Description, etc.)

• Weak entities
• ORDERS (Date, etc.) – depends on CUSTOMERS and PRODUCTS

• Associations:
• PRODUCTS – CATEGORIES (M:M)
• CUSTOMERS – ORDERS (1:M)
• ORDERS – PRODUCTS (M:M)
Entity-Relationship (ER) Diagram

• The cardinality ratio of an association is determined by the


designer so as to reflect as accurately as possible how to organize
the modeled activity
• How to establish entity types and associations is not unique: the
same functionality can be achieved through a variety of ER
diagrams
• A lot of entities are called by a noun, and an association is called (as
a rule) by a verb, because an association is an interaction between
entities
Entity-Relationship (ER) Diagram

• The ER model does not specify how associations between sets of


entities are made: this depends on the data structure used for the
database:
• In the hierarchical model and network model the associations are made by
pointers from an entity to the associated entities
• In the relational model the associations are made by the equality of values of
common attributes of the sets of entities (keys)
• In the object-relational model, associations are represented by references that
use unique object identifiers
Hierarchical model

• The hierarchical data model organizes the data in a tree-like


structure with a single root
• The data is stored as records which are inter-connected through
links
• A record is a collection of attributes, each attribute containing a
single value, with an associated data domain
• The hierarchical model mandates that each child record has only
one parent and each parent can have one or more child records
• In order to retrieve data from a hierarchical database the whole tree
needs to be traversed starting from the root node
Hierarchical model
Network model

• The network model is an extension of the hierarchical data model.


• The data is organized more like a graph, with entity types are
represented as nodes and associations are represented as arcs
• In this model, entities are allowed to have more than one parent
node
• Since the data is more related, the access to data is easier and faster
• The network model was the first to map many-to-many relations
• This was the most widely used database model, before the
relational model was introduced
Network model

You might also like