You are on page 1of 16

Chapter 2 : Review of Databases

and
Computer Networks

Reference: Distributed Database principles and concepts , Stefano Ceri , Giuseppe Pelagatti
Outline
• Concepts and notations needed.

• Review of Databases.

• Review of computer Networks.


Review of Databases
• Data model : Relational model
Allows powerful , self-oriented , associative expressions

• Data Manipulation language:


• Relational Algebra: describe & manipulate access strategies to
DDB
• SQL: Writing application programs for DDB.

• Review on
• Relational model
• Database applications, programs & transactions.
Relational model
• Relations: tables.
• Attributes: # of columns.
• Tuples: # of rows.
• Grade: # of attributes of a relation.
• Cardinality: # of tuples.
• Domain: Set of possible values
for a given attribute

• Rules:
• No two identical tuples in the same relation.
• No defined order of the tuples of a relation.
• Order of columns in a relation is immaterial.
• Some attributes are key (single or composite).
Relational algebra
• Collection of operations on relations takes one or more relations as operands and
produces one relation as result.
• Can compose of arbitrary complex expressions.
• Operations

Unary Binary
• Take only 1 relation as operand • Take only 2 relations as operands
• Operators: • Operators:
• Selection • Union
• Projection • Difference
• Cartesian product
• Join
• Semi-join
Relational algebra
Unary Operations
• Selection SLFR (σ)
• R: operand to which selection is applied
• F: a formula which expresses selection condition/predicate.
•Projection PJAttrR (П)
•Attr: denotes a subset of the attributes of operand relation.
•Replicated tuples are eliminated.
Relational algebra
Binary Operations
• Union R UN S
• R, S : relations. Meaningful only between two relations with same schema.
• Union tuples of R and S (All tuples appearing either in R or S or both)
• UN(R1,R2,R3, …..,Rn) = R1 UN R2 UN R3 …..UNRn

•Difference R DF S
• The difference between tuples of R and S (All tuples on R but not S)
Relational algebra
Binary Operations
• Cartesian Product R CP S
• R, S : relations.
• Every tuple of R is combined with every tuple of S to form one tuple of
the result.
• If two attributes of same name appear in both R and S, both are included.
Relational algebra
Binary Operations
• Join R JNFS
• F : formula specify join condition.
• Equi-join : if only equality appears in F.
• Join derived from selection and Cartesian product
R JNFS = SLF(R CP S)
•Natural join R NJN S
• Equi-join in which all attributes with same name in the 2 relations are
compared.
• One of the 2 attributes is omitted from result if both have same name and value
•Semi-join R SJF S
• F : formula specify join condition/predicate
•Derived from projection and join
R SJF S = PJAttr(R) (R JNFS )
Where Attr(R) :Set of all attributes of R
Relational algebra
Binary Operations
• Natural semi-join R NSJ S
• Considering semi join with same join condition in natural join.
SQL
• Simple Statement
Select [attribute list]
From [relation name]
Where [predicate]

• Example
Database applications, Programs & Transactions
Application(denote function requested by user )
•Sequence of operation requested by end user (not a programmer) with a single activation
request.
• Can be Online (requested by user at a terminal & requires response in a short time) or batch
(requested by an operator)
• Each application has an application code, used to request its execution
• Online applications can be classified as
• Simple application: receive 1 input message & produce 1 output message.
• Conversational application: exchange several message with user.
• Read only application: read data from DB with out updating
Transaction
• Atomic unit of DB access either executed entirely or not executed at all.
• An application may consist of zero, one or several transactions, but a transaction belongs to only
one application
Program (denotes implementation of application in programminglanguage)
•A unit having its own address space which communicates with other programs only through
messages and synchronization primitives.
Query(denotes DB request)
• Expression in suitable language which defines a portion of data contained in DB – the function
which is performed by a program which accesses the db.
Review of Computer Network
• Model
• Communication network Connecting Hosts
•Communication links (coaxial cables , satellite links, telephone lines…etc) includes several
computers
• Facility Provided
•A process running at any site can send a
message to a process running at
any other site of the network.
• Parameters to be consider
• Delay of message delivery to its destination.
- Heavy usage increase delay
- Queuing analysis for messages will be
required to evaluate delay
• Cost of transmitting message: fixed
-Cost associated with each message + a cost
proportional to message length
• Reliability of Network
- probability that the message is correctly delivered
Review of Computer Network
• Types of Communication network & Network Topologies
Review of Computer Network
Protocols & Sessions:
• Protocols: (Rules followed by 2 or more processes for communication.)
• Agreement between sender & receiver processes to exchange messages
• How to recognize and identify each other
• How many messages exchanged
• Messeages need answer or not …etc
• Sessions:
• Established between 2 processes which want to communicate & is held
until all necessary messages exchange.
• Closing a session similar to hanging up in a phone call.
• High level facility provided by communication network & does not
imply existence of direct physical connection
•For irregular pattern exchange of messages; sending datagram
messages instead of establishing session
Review of Computer Network
•ISO/OSI Reference architecture (international standards organization / Open Systems
Interconnection)

• Each level offer virtual communication


facility to higher level layer
•Application Layer: DDB is a particular
Application
•Presentation layer: Conversation of info
between different forms of data
Representation
•Session layer: Establishing and maintaining
sessions between processes
•Transport layer: True source to
destination messages(broken
or compacted) delivery layer.
• Network, Data-link & physical layer:
TL uses for performing function efficiently

You might also like