Professional Documents
Culture Documents
i. Definition :
A data base management system (DBMS) is a software
system destined for storing and sharing information in a
database. It also allows recording, retrieving, editing, sorting,
transforming, or printing the information of the database.
Exp:
1- The age of a person must be a positive integer. The DBMS
checks the entered data that respects this rule.
When these data are used, the system verifies permanently the
respect of these constraints as follows:
Real world
Independent from
a DBMS
Specifications of
Analyze
the DB
Conception
Conceptual
Specified to a
model
DBMS
Transformation in Logical
logical model
model
Physical Internal
Conception model
III. Database Administrator:
2. Distributed database:
A distributed database is a collection of logically related
databases that are physically distributed over a network.
2. Heterogeneous database:
A heterogeneous database is a distributed database generated
by several types of DBMS.
CHAPTER TWO
1. Attribute:
An attribute is identifier (a name) that describes
information stored in a database.
Person
Person_Id
First name
Last name
Date of birth Age= Current date – date of birth
Age
Derived attribute
3. A relation:
Exp:
Diagram (intention Professors
Of the relation) (Prof_id, Prof_name, DB, certificate, major, …)
1. Key constraints:
Exp:
- For a car, a candidate key could be his registration number,
or serial number, which are supposed to be unique.
Exp 1:
Exp 2:
Key Attribute
Exp 3: the table "Customers" has a unique key (one column C_Id)
while the table "Purchase" has a multiple key (several columns
formed the key: (C_Id, prod_id, Date_purch).
Customer Products
… … … … … … … … …
Purchase
… … …
IV- Relational algebra:
Customer Nationality
C_Id FN LN DB Nat_id Nat_id Desc
1 Wafaa Saleh 5/6/1992 1 1 Lebanese
2 Samir Hanna 9/8/1993 2 2 Syrian
3 Ali Ahmad 9/8/1993 1 3 Egyptian
4 Faten Makki 15/2/1992 1
5 Ali Makki 10/10/1993 1
Syntax:
RelName = PROJECT (tablename, attr1, attr2, attr3, …)
R1
FN LN
Wafaa Saleh
Samir Hanna
Ali Ahmad
Faten Makki
Ali Makki
Syntax:
RelName = SELECT (tablename, condition )
Exp: display the customers that have numbers greater than 3:
R2= SELECT (CUSTOMER, C_Id>3)
R2
C_Id FN LN DB Nat_id
4 Faten Makki 15/2/1992 1
5 Ali Makki 10/10/1993 1
Syntax:
RelName = UNION (tablename1, tablename2)
Customer STRANGE_C
C_Id FN LN DB Nat_id C_Id FN LN DB Nat_id
1 Wafaa Saleh 5/6/1992 1 2 Samir Hanna 9/8/1993 2
3 Ali Ahmad 9/8/1993 1
4 Faten Makki 15/2/1992 1
5 Ali Makki 10/10/1993 1
R3
C_Id FN LN DB Nat_id
1 Wafaa Saleh 5/6/1992 1
2 Samir Hanna 9/8/1993 2
3 Ali Ahmad 15/2/1992 1
4 Faten Makki 15/2/1992 1
5 Ali Makki 10/10/1993 1
d. The DIFFERENCE operator: it constructs a set of two different
tables. Suppose that R and S are two tables with the same
structure. The difference R - S is the set of tuples present in R but
not in S.
Syntax:
RelName = DIFFERENCE (tablename1, tablename2)
Syntax:
RelName = PRODUCT (tablename1, tablename2)
Exp1:
R: S:
R X S:
f. The JOIN operator: this operator is used to
combine data (rows or columns) from 2
tables based on a common attribute
between them.
Syntax:
RelName = JOIN (tablename1, tablename2, condition of join)
g. Rename a relation:
The Rename operator returns an existing relationship in a
new name.
Syntax:
RelName = RENAME (old_tablename, new_tablename)
b. Division (÷):
This operator is used when we wish to express queries with “all”:
Exp: Consider:
Results Students
T=Results Students
Subj_name Year
VB.net 2
3. Relational queries:
Exp:
Given the two following tables (or relations):
Customer(CodeCustomer, CustomerName, CustomerAdr, Tel)
Order(OrderNb, Date, CodeCustomer *)
Query 1:
We would like to obtain the code and the name of the customers
who ordered the 10/06/2017:
EXERCISE N°1
EXERCISE N°2
EXERCISE N°3
a. A data file:
A data file is a structural recipient of information
concerning only one object of the real world (Exp : Students,
Professors, …), and characterized by its name.
b. A field :
A field is the elementary information of a data file.
Field
a. Sequential access:
A sequential access means that we must accede to the
elements in a sequential order. That’s means, if we want to accede
to the record No N; we must read all the previous records (N-1
records).
c. Blocked articles:
Some FMS (File management System) organizes disk
space in blocks of sectors.
2. Delete a file:
Deleting a file is the action of erasing (destroying) it from the
storage hardware where it is stored.
3. Copying a file:
This action consists of reproducing another copy of a source file
in order to obtain 2 separate files of the same origin.
4. Moving a file:
To move a file, the system must transmit information from a
starting point (source) to an ending point (destination) on the
same storage device or no.
5. Back up a file:
Backup consists of duplicating and securing the data contained
in a computer system.
6. Sorting a file:
Sorting a file consists of classifying its articles in an ordering
manner (either increasing –ascending or decreasing –
descending).
7. Merging files:
When several files (source) deal with the same subject but
under different titles, the merging consists in bringing them
together to obtain a single global file (destination).
8. Splitting a file:
This action consists of obtaining several files (destination) from
a single file (Source).
b. At article level:
1. Insert an article:
This action consists of adding new articles to an existing file.
Exp: In a sequential file, new articles are inserted at the end of
the file.
2. Delete an article:
This action consists of removing or deleting articles from an
existing file.
3. Read an article:
This action consists in consulting one or more articles of a file in
order to know their contents.
4. Update an article:
This action consists of changing (adjusting or modulating) the
content of one or more articles in order to update or maintain a
file.
CHAPTER FOUR
Le vent se lève (wind picks up) 2006 124 Diaphana Films Cillian Murphy
We write: X → Y
Exp1:
Exp2:
Grade (contrôle_nb, student_Nb, grade)
(contrôle_nb, student_Nb) → grade
1. Reflexivity: if X Y and Y X
then X X.
2. Augmentation (increase) : if X Y
then X,Z Y,Z.
3. Transitivity : if X Y and Y Z
then X Z.
5. Decomposition : if X Y,Z
then X Y and X Z.
6. Union : if X Y and X Z,
then X Y,Z.
III- The normalization theory:
The Normalization permits to eliminate abnormalities of storage,
and the redundancy in order to have a coherent database.
There is an EFD that is not the result of a key and which determines
an attribute belongs to a key. This relation is in 3NF but not BCNF.
To have relational schema in BCNF, we must decompose Person:
Person (#SS_nb, # Region => Name)
Region (#Region, Country).
EXERCISES
NORMALIZATION AND
FUNCTIONAL DEPENDENCIES:
2) Given R (A, B, C, D, E, G, H)
and F= {A, BC ; BD ; C, DE ; GA ; DH}
Using the axioms of Armstrong, show that we can deduce the following sets:
1. BH.
2. B,G C.
3. A,B E.
8) Given the relation named Exam defined by the following relational schema:
(2nd Session 2012)
- Exam (ExamNo, ExamDate, CourseNo, CourseName, coefficient)
- The set F of functional dependencies is the following:
- What is the biggest normal form of relation Exam? Justify your answer.
9) The following relation describes commands made by clients, with the products
and quantities ordered by the client.
Commands (ComNb, ComDate, CliNb, AdrCli, ProdNb, Price, Qty)
a- What is the key to this relation?
b- In what normal form it is?
c- Put it in the 3NF.
10) Let the relation R (A, B, C, D) and the following FD:
BC -> D, C -> A, AB -> C
a- Give the key of the relation?
b- What are the violations of BCNF?
c- Decompose the relation, if necessary, into a collection of BCNF relations.
11) Let the following relation: R(A,B,C,D,E) and the following FD:
A→B, A→C, BC→A and D→E
a- Identify if R is in 3NF or BCNF.
b- If it is not BNCF propose R into a collection of BCNF relations.
BD
C, D E
C, E G
C, E H
GA