Al Karma Language School
Al Karma Language School 
CHAPTER ONE 
DATABASES 
1- Data: 
Data are the primary raw materials. 
2-Information: 
It is the output of data processing to extract the content of data or what they refer to as 
indications, sign, comparisons etc.Data are the basic information 
3-The table 
The table is the vessel that contains a set of data of a certain topic where data are stored 
4- Record: 
It is the place "row" where the integrated data are stored, for example, all the 
personal data of a certain person (Name, address and telephone).Etc 
5- Field 
The Field is the place (column), where one kind of data is stored such as the data of 
(person - address ... etc). 
6- Definition of Database: 
Database is a group of organized data associated with a certain topic inside a table or 
tables. 
7-The advantages of databases 
· Storing, classifying, organizing, and indexing Data in a way that can help in retrieving 
them; hence they can be processed easily. 
· The flexibility in modifying data through adding or exchanging data with the new ones 
(Updating data). 
· It is easy to create forms to make data entry easier. 
· It makes search and query easy to find the stored data and information in the database. 
· Displaying Data and information in form of reports in which data can be extracted , 
analyzed to support and make decision 
8- Types of database in terms of (Design View): 
- Hierarchical Database Model 
- Network Database Model 
- Relational Databases Model (They will be studied later in detail) 
2
Al Karma Language School 
CHAPTER TWO 
(Entity Relationship Model) 
The definition of Entity Relationship Model: 
The Entity Relationship Model is one of the common styles to set an outlay for the 
Relational Database that depends on the following: 
1- Dividing the system to Entities such as (Employee Entity – Department Entity in a 
company's system.) 
2- Each Entity contains certain attributes describing and defining it (such as the 
company's name, address) etc. 
3- Defining the relationships among these entities and describing them as will be shown 
later. 
4- Represent this through a drawing, which is called: 
(Entity Relationship Diagram) ERD 
The importance of the Entity Relationship Diagram: 
It is a prior step to implement the database in one of the programmes of the RDBMS 
(Relational Data Base Management System). 
It helps in making tables or files for the database and the relationships among them on 
correct and scientific bases. 
Entity definition: 
The ' Entity' is an object that has an independent existence. It may be of a real 
existence such as, an employee - a car – an item – a supplier or an abstract existence 
such 
as a project- a training course. Each entity has attributes that describe and define it, such 
as (employee number, name, gender, address, and telephone). All these are attributes to 
describe the employee Entity. 
Entity Attributes Entity key 
Employee Salary- address- birth date gender-name- 
employee number 
Employee number 
Department Number of employees-location name-department 
number 
department number or 
department name 
Project location- name- project number project 
Definition of the Key attribute: 
It is the attribute whose value can never be recurred inside the entity. 
Consequently, it distinguishes each single entity1 from the others. For example, 
an employee cannot have the same national number of another. 
3
Al Karma Language School 
Secondly: Defining the relationships among the entities and their attributes: 
Relationships among entities are defined in terms of …: 
1- Type of relationship (One to One) or (One to Many) or (Many to Many) 
Later we will explain each type. 
2- The type of participation of each entity in the relationship may be either 
(Total Participation or Partial Participation). 
The definition of (Participation Type) 
Participation means that a certain Entity depends in its existence on the necessity 
of its existence in a certain relationship with another entity and in this case, it is a total 
participation for this entity in this relationship. . 
Example: 
In the relationship of an employee in managing a department, we find that there is a 
(Total Participation) for the "Department Entity". In other words, there is no department 
without an employee to run. At the same time there is (Partial Participation) for 
"employee entity "in this relationship, not every employee can run a department 
Now we define the relationships found in the system: 
(1) There are two relationships between an "Employee Entity" and 
"Department Entity" they are: 
a) The relationship of "work in a department" It is described as follows: 
1- Each department should have a number of employees. 
2- No employee can work in more than a department . 
3- There is no department without employees to work in it. 
4- Each employee should work in a department... 
5- There are no attributes for this relationship. 
Therefore: 
- The relationship is ' One to Many ' between "Department Entity" and" Employee 
Entity" 
(1 and 2) 
- There is a (Total Participation) for ' Department Entity ' in this relationship. (3) 
- There is a (Total Participation) for ' Employee Entity' in this relationship. (4) 
- There is no attribute for this relationship. 
Summary of relationships in a company's system: 
Relationship 
First 
The other 
Relationship 
Relationship 
name 
entity 
entity 
type 
attributes 
The entity 
Total 
participation 
Work in a 
departmen 
employee department One to Many Not exist Department - 
Employee 
Manage a 
department 
employee department One to One Starting date Department 
Work in a 
project 
employee project Many to 
Many 
Number of 
hours 
Project - 
employee 
4
Al Karma Language School 
Summary for the most important used symbols in "ERD" 
The meaning of the symbol symbol 
Entity 
Relationship 
Attribute 
Key attribute 
The multi - valued 
attribute 
Derived attribute 
One to One 
relationship 
One to Many relationship Entity 
1 1 Entity a R Entity b 
Entity a R Entity b 
Many to Many relationship 
Total participation for R the entity in the 
relationship 
5 
N 
M 
N 1 
Entity a R Entity b 
Entity a R Entity b
Al Karma Language School 
CHAPTER THREE 
Relational Database Model 
First: Drawing a table for each entity in [ERD], we find that the fields are the attributes 
of this entity: 
Employee: 
Employee number name gender Birth date address salary 
Department 
Department number Department name 
Project 
project number name Location 
Notes: 
· The name of the table is put at the top before the field name. 
· One of the entity key attributes is selected to be a primary key and underline 
the field name to highlight it. 
· The field of (Employees number) has not been put for each "department" in 
(Department Table), because the number of employees is a derived attribute. 
In other words, it can be counted from the relationship between (department) 
and (employee). 
· Field location has not been put for the (Department table) because 
(Department location) represents a multi- valued attribute. In other words, a 
certain department can have more than a location as shown in the following 
example; this is in case of putting the field of (Department location) in 
(Department table). 
Definition : 
The composite key is more than a field in a table whose components together do 
not recur. It distinguishes each record where as each field can be repeated solo. 
1-Between the tables of (Department and Employee) 
a-The relationship of "working in department ": 
As the relationship "One to Many" in department table as shown in the previous 
chapter from the ERD. Therefore, we will add a field in the table that represents 
(Many) in the "employee table", In this case, it expresses (Department Number) 
where an employee works. In other words, this field is linked to the field of 
(Department number) in (Department table). In this case, it is called (Foreign Key 
Field) 
Definition 
The Foreign Key is a strange field in a table linked to "Primary Key" in another table. 
NOTE: 
It is not required to nominate the foreign key with the primary field name linked 
to it. However, it must be of the same type and size as shown in designing the table 
using the computer. 
6
Al Karma Language School 
Definition : 
The relationship of ( One to Many) between two tables means that it is possible 
for a 
record in the first table (One) to be linked to more than a record in the second 
table 
(Many ) and any record in the second table (Many) can be linked only to one 
record in 
the first table (One). 
7

Computer sec2-1st term

  • 1.
  • 2.
    Al Karma LanguageSchool CHAPTER ONE DATABASES 1- Data: Data are the primary raw materials. 2-Information: It is the output of data processing to extract the content of data or what they refer to as indications, sign, comparisons etc.Data are the basic information 3-The table The table is the vessel that contains a set of data of a certain topic where data are stored 4- Record: It is the place "row" where the integrated data are stored, for example, all the personal data of a certain person (Name, address and telephone).Etc 5- Field The Field is the place (column), where one kind of data is stored such as the data of (person - address ... etc). 6- Definition of Database: Database is a group of organized data associated with a certain topic inside a table or tables. 7-The advantages of databases · Storing, classifying, organizing, and indexing Data in a way that can help in retrieving them; hence they can be processed easily. · The flexibility in modifying data through adding or exchanging data with the new ones (Updating data). · It is easy to create forms to make data entry easier. · It makes search and query easy to find the stored data and information in the database. · Displaying Data and information in form of reports in which data can be extracted , analyzed to support and make decision 8- Types of database in terms of (Design View): - Hierarchical Database Model - Network Database Model - Relational Databases Model (They will be studied later in detail) 2
  • 3.
    Al Karma LanguageSchool CHAPTER TWO (Entity Relationship Model) The definition of Entity Relationship Model: The Entity Relationship Model is one of the common styles to set an outlay for the Relational Database that depends on the following: 1- Dividing the system to Entities such as (Employee Entity – Department Entity in a company's system.) 2- Each Entity contains certain attributes describing and defining it (such as the company's name, address) etc. 3- Defining the relationships among these entities and describing them as will be shown later. 4- Represent this through a drawing, which is called: (Entity Relationship Diagram) ERD The importance of the Entity Relationship Diagram: It is a prior step to implement the database in one of the programmes of the RDBMS (Relational Data Base Management System). It helps in making tables or files for the database and the relationships among them on correct and scientific bases. Entity definition: The ' Entity' is an object that has an independent existence. It may be of a real existence such as, an employee - a car – an item – a supplier or an abstract existence such as a project- a training course. Each entity has attributes that describe and define it, such as (employee number, name, gender, address, and telephone). All these are attributes to describe the employee Entity. Entity Attributes Entity key Employee Salary- address- birth date gender-name- employee number Employee number Department Number of employees-location name-department number department number or department name Project location- name- project number project Definition of the Key attribute: It is the attribute whose value can never be recurred inside the entity. Consequently, it distinguishes each single entity1 from the others. For example, an employee cannot have the same national number of another. 3
  • 4.
    Al Karma LanguageSchool Secondly: Defining the relationships among the entities and their attributes: Relationships among entities are defined in terms of …: 1- Type of relationship (One to One) or (One to Many) or (Many to Many) Later we will explain each type. 2- The type of participation of each entity in the relationship may be either (Total Participation or Partial Participation). The definition of (Participation Type) Participation means that a certain Entity depends in its existence on the necessity of its existence in a certain relationship with another entity and in this case, it is a total participation for this entity in this relationship. . Example: In the relationship of an employee in managing a department, we find that there is a (Total Participation) for the "Department Entity". In other words, there is no department without an employee to run. At the same time there is (Partial Participation) for "employee entity "in this relationship, not every employee can run a department Now we define the relationships found in the system: (1) There are two relationships between an "Employee Entity" and "Department Entity" they are: a) The relationship of "work in a department" It is described as follows: 1- Each department should have a number of employees. 2- No employee can work in more than a department . 3- There is no department without employees to work in it. 4- Each employee should work in a department... 5- There are no attributes for this relationship. Therefore: - The relationship is ' One to Many ' between "Department Entity" and" Employee Entity" (1 and 2) - There is a (Total Participation) for ' Department Entity ' in this relationship. (3) - There is a (Total Participation) for ' Employee Entity' in this relationship. (4) - There is no attribute for this relationship. Summary of relationships in a company's system: Relationship First The other Relationship Relationship name entity entity type attributes The entity Total participation Work in a departmen employee department One to Many Not exist Department - Employee Manage a department employee department One to One Starting date Department Work in a project employee project Many to Many Number of hours Project - employee 4
  • 5.
    Al Karma LanguageSchool Summary for the most important used symbols in "ERD" The meaning of the symbol symbol Entity Relationship Attribute Key attribute The multi - valued attribute Derived attribute One to One relationship One to Many relationship Entity 1 1 Entity a R Entity b Entity a R Entity b Many to Many relationship Total participation for R the entity in the relationship 5 N M N 1 Entity a R Entity b Entity a R Entity b
  • 6.
    Al Karma LanguageSchool CHAPTER THREE Relational Database Model First: Drawing a table for each entity in [ERD], we find that the fields are the attributes of this entity: Employee: Employee number name gender Birth date address salary Department Department number Department name Project project number name Location Notes: · The name of the table is put at the top before the field name. · One of the entity key attributes is selected to be a primary key and underline the field name to highlight it. · The field of (Employees number) has not been put for each "department" in (Department Table), because the number of employees is a derived attribute. In other words, it can be counted from the relationship between (department) and (employee). · Field location has not been put for the (Department table) because (Department location) represents a multi- valued attribute. In other words, a certain department can have more than a location as shown in the following example; this is in case of putting the field of (Department location) in (Department table). Definition : The composite key is more than a field in a table whose components together do not recur. It distinguishes each record where as each field can be repeated solo. 1-Between the tables of (Department and Employee) a-The relationship of "working in department ": As the relationship "One to Many" in department table as shown in the previous chapter from the ERD. Therefore, we will add a field in the table that represents (Many) in the "employee table", In this case, it expresses (Department Number) where an employee works. In other words, this field is linked to the field of (Department number) in (Department table). In this case, it is called (Foreign Key Field) Definition The Foreign Key is a strange field in a table linked to "Primary Key" in another table. NOTE: It is not required to nominate the foreign key with the primary field name linked to it. However, it must be of the same type and size as shown in designing the table using the computer. 6
  • 7.
    Al Karma LanguageSchool Definition : The relationship of ( One to Many) between two tables means that it is possible for a record in the first table (One) to be linked to more than a record in the second table (Many ) and any record in the second table (Many) can be linked only to one record in the first table (One). 7