الدرس الاول

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

‫السنة الثالثة‬

‫مدخل الى قواعد البيانات‬ 2024-2023

In this first lesson, we will cover ‫سنتعرف في هذا المحور على أهم‬
the most important terms and basic ‫المصطلحات والمفاهيم اﻷساسية في قواعد‬
concepts in databases, starting with
‫ بداية بمفهوم البيانات بحد ذاتها ثم‬،‫البيانات‬
the concept of data, then getting to
know databases and the ‫التعرف إلى قواعد البيانات والصفات التي تتصف‬
characteristics that characterize their ،‫ كذا أنواعها ومختلف النماذج التي يعمل بها‬،‫بها‬
types and the various models in
‫أخيرا التعرف على أنظمة إدارة قواعد البيانات‬
ً
which they operate, and finally
getting to know Database .‫وذكر وظائفها‬
Management Systems (DBMS) and
mentioning their functions.

Introduction :‫مقدمة‬

Databases are present in many ‫قواعد البيانات موجودة في كثير من‬


applications and actions that we do in ‫التطبيقات واﻷعمال التي نقوم بها في حياتنا‬
our daily lives. They are present in ‫ فهي موجودة في أجهزة الحاسوب‬،‫اليومية‬
the computers and websites that we
‫ موجودة أيضا في‬.‫والمواقع التي نتفحصها‬
browse. It is also present in the social
networks that we spend a lot of time ‫الشبكات اﻻجتماعية التي نقضي الكثير من الوقت‬
with, where the topics we write and ‫معها حيث المواضيع التي نكتبها والرسائل التي‬
the messages we send are saved in
‫ هذه اﻷخيرة‬.‫نرسلها تحفظ في قواعد البيانات‬
databases. The latter is also present in
smartphones where names, messages ‫موجودة أيضا في الهواتف الذكية حيث اﻷسماء‬
and email data are stored in special ‫والرسائل وبيانات البريد اﻹلكتروني تخزن في‬
databases. Most applications only
‫ معظم التطبيقات ﻻ تعمل إﻻ‬.‫قواعد بيانات خاصة‬
work with databases.
.‫بوجود قواعد البيانات‬
Data
: ‫البيانات‬
They are numbers, letters, symbols,
or words that can be processed by a ‫هي اﻻرقام أو الحروف أو الرموز أو الكلمات‬
computer.
.‫القابلة للمعالجة بواسطة الحاسب‬
Information
: ‫المعلومات‬
It is data that has been organized or
processed to make the most of it (See ‫هي بيانات تم تنظيمها أو معالجاتها لتحقيق‬
the following figure). . (‫أقصى استفادة منها )انظر الشكل التالي‬

‫سامي‬ ‫م ف‬/‫د‬-‫ حان أم ة‬/‫د‬ 1


‫السنة الثالثة‬
‫مدخل الى قواعد البيانات‬ ‫‪2024-2023‬‬

‫معلومات‬ ‫مجموعة من‬


‫معالجتها وترتيبها وتحويلها إلى‬
‫أكثر وضوحا‬ ‫البيانات‬

‫ﻻتخاذ قرار‬
‫نقوم بتسليمها للمستخدم النهائي‬ ‫معين‬

‫‪Figure 1: from Data to information‬‬

‫‪Example: let the following be a set of‬‬ ‫مثال‪ :‬لتكن مجموعة من البيانات التالية التي ﻻ معن‬
‫‪meaningless data.‬‬ ‫لها‪.‬‬

‫‪15% 16 33‬‬ ‫‪15% 16 33‬‬

‫‪16% 18 30‬‬ ‫‪16% 18 30‬‬

‫‪If we assume that it is a weather‬‬ ‫ل‬ ‫ل اف ض ا أنها ‪l‬قاع ة ب انات حالة ال ق ‪ :‬ي ت‬
‫‪database: this data is converted into‬‬ ‫فة أف ل‬ ‫ت ض ها‬ ‫ه ه ال انات إلى معل مات و‬
‫‪information and is better explained to the‬‬
‫إضافة‪ :‬ال ي ة‪ ،‬درجة ال ارة‪ ،‬س عة‬ ‫م وذل‬ ‫لل‬
‫‪user by adding: city, temperature, wind‬‬
‫ال اح ون ة اﻻم ار‪.‬‬
‫‪speed, and rainfall percentage.‬‬

‫‪rainfall‬‬ ‫‪Wind-‬‬ ‫‪Tempe-‬‬ ‫‪City‬‬ ‫ن ة‬ ‫س عة‬ ‫درجة‬ ‫ال ي ة‬


‫‪percentage‬‬ ‫‪rature‬‬
‫‪speed‬‬ ‫اﻻم ار‬ ‫ال اح‬ ‫ال ارة‬
‫‪%15‬‬ ‫‪16‬‬ ‫‪33‬‬ ‫‪Algiers‬‬ ‫‪15%‬‬ ‫‪16‬‬ ‫‪33‬‬ ‫ال ائ‬
‫‪%16‬‬ ‫‪18‬‬ ‫‪30‬‬ ‫‪Annaba‬‬ ‫‪16%‬‬ ‫‪18‬‬ ‫‪30‬‬ ‫عاة‬

‫‪Information can be classified by:‬‬ ‫ف ال عل مات‪:‬‬ ‫ت‬

‫سامي‬ ‫د‪ /‬حان أم ة‪-‬د‪/‬م ف‬ ‫‪2‬‬


‫السنة الثالثة‬
‫مدخل الى قواعد البيانات‬ 2024-2023

 According to its nature: :‫ع ها الى‬ ‫ح‬


 Numerical information: which takes
.‫ ال ي تأخ ش ل رق ي‬:‫ معل مات ع د ة‬
digital form.
‫ ال ي تأخ شـ ـ ـ ـ ـ ـ ل سـ ـ ـ ـ ــل ـ ـ ـ ـ ــلة‬:‫ معل مات ح ة‬
 String information: which takes the
.‫ح ة‬
form of a sequence of characters.
 Graphical information: which is in ‫ ال ي ت ن على شـ ـ ـ ل رس ـ ـ ـ م‬:‫ معل مات ب ان ة‬
the form of graphs, such as curves, ‫ات وال رجات ال ارة وص ـ ـ ـ ـ ر‬ ‫ب ان ة ال‬
histograms, logo images, and others. .‫ال عارات وغ ها‬
 According to its source:
:‫رها الى‬ ‫م‬ ‫ ح‬
 Internal information: it is ‫ هي ال عل مات ال ات ة م‬:‫معل مة داخل ة‬ 
information resulting from internal
‫م ادر داخل ة ل س ة ما اي ت أ قاع ة‬
sources of an organization where the
،‫ون‬ ‫ة ال‬ ،‫ة ال عات‬ ‫ال انات م ل‬
database is created, such as sales
...
quantity, inventory quantity.
 External information: it is ‫ هي ال عل مات ال ات ة م‬:‫ معل مة خارج ة‬
information resulting from sources ‫م ادر خارج ة لل س ة م ل أسعار‬
external to the organization, such as ...,‫ أسعار ال اد اﻷول ة‬، ‫ال اف‬
competitors’ prices, prices of raw
materials.
 According to its processing: :‫معال ها الى‬ ‫ ح‬
‫ هي ال عل مات ال ي ي إدخالها‬:‫ م خﻼت‬
 Inputs: information that is entered for
processing. .‫لل عال ة‬

 Outputs: this is the information that ‫ هي ال عل مات ال ي ت ج ع‬:‫ م جات‬


is produced after processing, such as ... ، ‫ الف ات‬، ‫ف ال قا‬ ‫ال عال ة م ل‬
invoices. ‫ هي الق اع ال ي ت‬: ‫ ال عل ات او اﻷ وام‬
 Instructions: these are the rules that
.‫ل على ال ائج‬ ‫لل‬
are applied to obtain results.

‫سامي‬ ‫م ف‬/‫د‬-‫ حان أم ة‬/‫د‬ 3


‫السنة الثالثة‬
‫مدخل الى قواعد البيانات‬ 2024-2023

Databases : : ‫قواعد البيانات‬


It is a collection of organized, arranged, ‫هي مجموعة من البيانات المنظمة والمرتبة‬
and logically interconnected data in tables
‫والمترابطة منطقيا في جداول مكونة من صفوف و‬
consisting of rows and columns. Databases
aim to organize and store huge data so that ‫ قواعد البيانات تهدف إلى تنظيم وتخزين البيانات‬.‫أعمدة‬
it is easy to use in various applications. .‫الضخمة بحيث يسهل استخدامها في مختلف التطبيقات‬
Databases are used in most fields and ‫تستخدم قواعد البيانات في أغلب المجاﻻت و النطاقات‬
domains, such as: commercial and
educational institutions, banks, airports, ,‫ البنوك‬،‫ المؤسسات التجارية و التعليمية‬:‫مثل‬
hospitals...etc. .‫إلخ‬...‫ المستشفيات‬,‫المطارات‬

Example: hospital system ‫ نظام المستشفى‬:‫مثال‬


If a hospital receives 1,000 patients a ‫ مريض يوميا و‬1000 ‫إذا كان مستشفى ما يستقبل‬
day and each patient receive a paper
،‫كل مريض يستلم ورقة لتشخيص عﻼجه و مرضه‬
diagnosing his treatment and illness, the
hospital will have 30,000 patients per ‫ مريض في الشهر‬30000 ‫فسوف يكون لدى المستشفى‬
month, which is equivalent to 360,000 ‫ فإذا احتجنا إلى‬.‫ مريض في السنة‬360000 ‫فيما يعادل‬
patients per year. If we need information
‫معلومة تفيدنا عن مرض ما أو إحصائيات ما فسوف‬
that will help us about a disease or
statistics, we will need many employees to ‫نحتاج إلى العديد من الموظفين حتى نتحصل على هذه‬
obtain this information from the ‫المعلومات من بين اﻷوراق المتراكمة وسوف يأخذ‬
accumulated papers. It will take a lot of
‫ إذن‬.‫الكثير من الوقت وقد ﻻ تكون هذه المعلومات دقيقة‬
time and this information may not be
accurate. So, the solution lies in databases. .‫الحل يكمن في قواعد البيانات‬

Databases importance: :‫أهمية قواعد البيانات‬


1. Storing data in one place regarding all
‫افة اﻷن ـ ـ ة ل هة‬ ‫ال انات في م ان واح‬ ‫ ت‬.1
activities of an entity in integrated and
accurate ways, and classifying and ‫هـ ه‬ ‫ق م ــاملــة ود قــة وت ـ ـ ـ ـ ـ ـ ـ ف وت‬ ‫مــا‬
organizing this data so that it is easy to
.‫ق ل‬ ‫هل اس جاعها في ال‬ ‫ال انات‬
retrieve in the future.
2. Follow up on the changes that occur in the ‫نة و‬ ‫ م ـا عـة ال غ ات ال ي ت ـ ث في ال ـات ال‬.2
stored data and make the necessary
modifications to it so that it is always in ‫إدخــال ال عـ ـ يﻼت الﻼزمــة عل هــا ح ى ت ن دائ ــا‬
the appropriate form for use immediately .‫امها ف ر ل ها‬ ‫رة ال ﻼئ ة ﻻس‬ ‫في ال‬
upon request

‫سامي‬ ‫م ف‬/‫د‬-‫ حان أم ة‬/‫د‬ 4


‫السنة الثالثة‬
‫مدخل الى قواعد البيانات‬ 2024-2023

3. Storing a huge amount of data that exceeds ‫ه ـ ـ ــائ ـ ـ ــل م ال ـ ـ ــان ـ ـ ــات ال ي ت ـ ـ ــاوز‬ ‫ ت‬.3
human capabilities to remember its details
and performing some operations and ‫تفاص ـ ـ ـ ـ ـ ـ ـ لها وج اء‬ ‫اﻻم ـان ـات ال ـ ـ ـ ـ ـ ـ ـ ة في ت‬
manipulations that are impossible to ‫ل ت ف ها‬ ‫ـــــــ‬ ‫الع ل ات وال عال ات ال ي‬ ‫ع‬
perform manually.
4. It helps to achieve complete .‫ي و ا‬
confidentiality of the data stored in it, so
‫نة‬ ‫ال ـ ـ ة ال املة لل انات ال‬ ‫ ت ــاع على ت ق‬.4
that no information is made available to
anyone who does not have the right to ‫له‬ ‫ل‬ ‫ﻻ ت اح أ ة معل مة ﻷ ش ـ ـ ـ‬ ‫بها‬
view it.
.‫في اﻻ ﻼع عل ها‬ ‫ال‬
Example:
:‫مثال‬
When you use an ATM, you use a gold
card with an electronic chip that carries a ‫ تقوم باستخدام‬,‫عند استخدامك للجهاز الصراف اﻵلي‬
unique number for you. Once you insert ‫البطاقة الذهبية ذات شريحة إلكترونية تحمل رقما مميزا‬
the card into the ATM, it asks you to enter
‫خاص بك و بمجرد إدخال البطاقة في الجهاز الصراف‬
the password. Then you can view your
account balance when you verify the ‫ عندها يمكنك‬,‫فإنه يطلب منك إدخال الرقم السري‬
validity of the entered password. If ‫اﻻطﻼع على رصيد حسابك عند التحقيق من صحة الرقم‬
someone wants to use your card that he ‫ فإذا بشخص ما يريد استعمال بطاقتك‬.‫السري المدخل‬
found, for example, he will not be able to
view your account balance because he ‫التي وجدها مثﻼ فإنه ﻻ يستطيع اﻻطﻼع على رصيدك‬
does not have the password. .‫الحسابي ﻷنه ﻻ يمتلك الرقم السري‬

Database features: :‫مميزات قواعد البيانات‬


 Speed in data extraction.
.‫ السرعة في استخراج البيانات‬
 Do not duplicate data, and this helps
.‫ عدم تكرار البيانات وهذا يساعد في تقليل الحجم‬
reduce the size.
 Ease of searching, adding, and ‫ السهولة في البحث واﻹضافة و التعديل على‬
modifying data.
.‫البيانات‬
 Interconnection between mutually
related data. .‫ الترابط بين البيانات ذات العﻼقة المتبادلة‬

 Providing security for data from damage. .‫ توفير اﻷمن للبيانات من التلف‬

‫سامي‬ ‫م ف‬/‫د‬-‫ حان أم ة‬/‫د‬ 5


‫السنة الثالثة‬
‫مدخل الى قواعد البيانات‬ 2024-2023

Types of databases: databases can be ‫ق اع‬ ‫ يمكن ت‬:‫أنواع قواعد البيانات‬


classified by:
:‫ال انات‬
 According to size to:
:‫ حسب الحجم إلى‬
 Small or simple databases: that suit the ‫ قواعد البيانات الصغرى او البسيطة التي تناسب‬
data of small institutions, MS Access can
‫ يمكن استخدام‬،‫بيانات المؤسسات الصغرى‬
be used to process them.
 Huge databases: that are characterized by .‫لمعالجتها‬Access ‫برنامج‬
a large and diverse volume of data and
‫ قواعد بيانات ضخمة تتصف بحجم كبيرو متنوع‬
require speed of implementation, making it
difficult to manage them with normal ‫ فيصعب‬,‫من البيانات و تتطلب سرعة التنفيذ‬

programs and systems. .‫ادارتها بالبرامج و النظم العادية‬


 According to the design model to: :‫ حسب الشكل إلى‬
 Hierarchical database model: :‫نموذج قاعدة البيانات الهرمي‬ 
This model was developed in the 1960s to
‫تم تطوير هذا النموذج في الستينات ﻹدارة‬
manage large amounts of data and arranges the
data in a tree-like structure. The top layer is the ‫كميات كبيرة من البيانات وترتب فيه البيانات في‬
main part of the part directly below it. This
‫ الطبقة العليا هي الجزء الرئيسي‬.‫بنية تشبه الشجرة‬
hierarchical model can be implemented in that
each parent has many children, but each child ‫للجزء الموجود تحتها مباشرة ويمكن تنفيذ هذا‬
only has one parent.
‫النموذج الهرمي على أن يكون لكل والد العديد من‬
Among its disadvantages is that it lacks
.‫اﻷطفال و لكن كل طفل لديه والد واحد فقط‬
flexibility and difficulty in moving between
records. You must start from the first record. It ‫من عيوبه يفتقد المرونة و صعوبة اﻻنتقال بين‬
requires complex programming. It is difficult to
‫ يتطلب برمجة‬،‫السجﻼت يجب البدء من أول سجل‬
make a change or modification to the structure
because the data is recorded in a hierarchical ‫ من الصعب ادراء تغيير او تعديل على‬,‫معقدة‬
form.
.‫التركيب بكون البيانات مسجلة في شكل هرمي‬

Example: See the following figure for a ‫ انظر الشكل التالي لنموذج قاعدة البيانات‬:‫مثال‬
hierarchical database model for a library
‫الهرمي لنظام مكتبة‬

‫سامي‬ ‫م ف‬/‫د‬-‫ حان أم ة‬/‫د‬ 6


‫السنة الثالثة‬
‫مدخل الى قواعد البيانات‬ 2024-2023

Figure2 : hierarchical database model for a library

For this hierarchical model, moving from the ‫ اﻻنتقال من‬،‫بالنسبة لهذا النموذج الهرمي‬
book to extracting the author of the book is easy,
but moving from the author to the number of ‫الكتاب إلى استخراج مؤلف الكتاب سهل أما‬
books written by him is difficult, so you must ‫اﻻنتقال من المؤلف إلى عدد الكتب التي ألفها‬
return to the first record.
.‫صعب فيجب الرجوع إلى السجل اﻷول‬
 Network database model: :‫ نموذج قاعدة البيانات الشبكية‬

This model appeared in the same period ‫ظهر هذا النموذج في نفس فترة النموذج‬
as the hierarchical model. The database of
‫ تعرض قاعدة بيانات هذا النموذج بشكل‬.‫الهرمي‬
this model is presented in a network and
based on a group of nodes. Each node ‫ كل عقدة‬,‫شبكة و على أساس مجموعة من العقد‬
represents a record, so that each record can ‫تمثل سجل بحيث يمكن لكل سجل الحصول على‬
have many parent and child records, and it
‫سجﻼت أصلية و فرعية كثيرة و يمكن أن يكون لها‬
can have more than one parent, unlike the
hierarchical model. .‫أكثر من أب عكس النموذج الهرمي‬
‫من عيوبه انه غير مرن ومعقد من الناحية‬
Its disadvantages are that it is inflexible
and complex in terms of programming and .‫البرمجية والصيانة‬
maintenance.

‫سامي‬ ‫م ف‬/‫د‬-‫ حان أم ة‬/‫د‬ 7


‫السنة الثالثة‬
‫مدخل الى قواعد البيانات‬ ‫‪2024-2023‬‬

‫كتاب‬ ‫المؤلف‬
‫عنوان الكتاب الرمز‬ ‫اسم المؤلف الرمز‬

‫كتاب‬ ‫المؤلف‬
‫عنوان الكتاب الرمز‬ ‫اسم المؤلف الرمز‬

‫كتاب‬ ‫المؤلف‬
‫عنوان الكتاب الرمز‬ ‫اسم المؤلف الرمز‬

‫‪Figure 3 : Network database model for a library‬‬

‫‪Example:‬‬ ‫مثال‪:‬‬

‫‪The network database of the author and‬‬ ‫ليكن لدينا قاعدة البيانات الشبكية للمؤلف‬
‫‪the books he wrote as illustrated in the‬‬
‫والكتب التي ألفها في الشكل أعﻼه‪.‬‬
‫‪figure above.‬‬

‫‪ This model is characterized by‬‬ ‫‪ ‬يتميز ه ذا النموذج بس رع ة اﻻنتق ال من‬


‫‪the speed of moving from the‬‬
‫الكت اب إلى اس تخراج مؤلف ه ومن المؤلف‬
‫‪book to extracting its author and‬‬
‫‪from the author to extracting the‬‬ ‫إلى استخراج عدد الكتب التي ألفها‪.‬‬

‫‪number of books he wrote.‬‬


‫‪ Its disadvantages include the‬‬ ‫‪ ‬من عيوبه التعقيد في التص ميم الذي يتطلب‬
‫‪complexity of the design, which‬‬
‫أحج ام كبيرة لتخزين البي ان ات وك ذل ك إلى‬
‫‪requires large amounts of data‬‬
‫‪storage, as well as sophisticated‬‬ ‫لغات راقية من البرمجة‪.‬‬

‫‪programming languages.‬‬

‫سامي‬ ‫د‪ /‬حان أم ة‪-‬د‪/‬م ف‬ ‫‪8‬‬


‫السنة الثالثة‬
‫مدخل الى قواعد البيانات‬ 2024-2023

 Relational database model: :‫ نموذج قاعدة البيانات العﻼئقية‬

This model appeared in the seventies of the ‫ أساس النموذج‬.‫ظهر هذا النموذج في السبعينات‬
last century. The basis of the relational model
is a mathematical concept known as ‫ تسمى أيضا‬,‫العﻼئقي هو مفهوم رياضي يعرف بالعﻼقة‬
relationships, also called tables, consist of
rows and columns. The columns are attributes ‫ تكون اﻷعمدة‬,‫بالجداول تتكون من صفوف و أعمدة‬
and each row is called a record. Relational
databases have become the most widely used
‫ أصبحت قواعد‬.‫هي الصفات وكل صف يسمى بالسجل‬
and widespread due to their ease of design and
‫البيانات العﻼئقية اﻷكثر إستخداما و إنتشارا نظرا‬
programming.
.‫لسهولة تصميمها و برمجتها‬

Example:
:‫مثال‬
The following figure represents the ‫الشكل التالي يمثل قاعدة البيانات العﻼئقية‬
relational database consisting of the
‫ جدول الكتاب و جدول‬:‫المكونة من الجدولين التاليين‬
following two tables: the book table and
the author table. .‫المؤلف‬

Figure 4:Relational database model for a library

The previous figure shows the ‫الشكل السابق يبين العﻼقة بين جدول الكتاب‬
relationship between the book table and
the author table through the author code ‫وجدول المؤلف من خﻼل عمود رمزالمؤلف المشترك‬
column shared between the two tables.
.‫بين الجدولين‬

‫سامي‬ ‫م ف‬/‫د‬-‫ حان أم ة‬/‫د‬ 9


‫السنة الثالثة‬
‫مدخل الى قواعد البيانات‬ 2024-2023

Database users ‫مستخدمو قواعد البيانات‬

 Database manager: He is the one who ‫ هوالذي يقوم‬:‫م دير قواع د البي ان ات‬ 
manages databases, controls work ‫بإدارة قواعد البيانات والتحكم في ص ﻼحيات‬
permissions, and monitors system and
‫العمل ومراقبة النظام وتحس ين أداء قواعد‬
database performance improvement.
.‫البيانات‬

 Database designer and software ‫مص م م ق واع د ال بي ان ات ومطور‬ 


developer: He is the one who designs
‫ هو ال ذي يقوم بتص ميم قواع د‬:‫ال ب رامج‬
databases to be created and built in a
highly efficient manner according to ‫البي ان ات ليتم إنش ائه ا وبن ائه ا بطريق ة ذات‬
user requirements and creates and ‫كفاءة عالية طبقا لمتطلبات المس تخدم ويقوم‬
develops applications.
.‫بإنشاء و تطوير التطبيقات‬

 Database user: Some users have ‫ بعض‬:‫مس تخ دم قواع د البي ان ات‬ 


sufficient experience to prepare the
‫المس تخدمين يكون لديهم الخبرة الكافية ﻹعدا‬
required queries in the query language,
and some users do not have the ،‫اﻻس تفس ارات المطلوبة بلغة اﻻس تفس ارات‬
experience, so special programs are ‫وبعض المس تخدمين ليس لديهم الخبرة فيتم‬
created for them that they run to obtain
‫إنش اء برامج خاص ة لهم يقومون بتش غيلها‬
what is required.
.‫للحصول على المطلوب‬

A database is a store in which data is ‫قاع دة البيان ات ه ي عب ارة ع ن مخ زن ي تم في ه‬


stocked. This store needs a system to
‫ ه ذا المخ زن يحت اج إل ى‬،‫تخ زين قواع د البيان ات‬
manage it, called a database management
system. .‫نظام يديره يسمى بنظام إدارة قواعد البيانات‬
In the next lesson, we will learn about
the database management system in ‫ف ي ال درس الق ادم س وف نتع رف عل ى نظ ام‬
general. .‫إدارة قواعد البيانات‬

‫سامي‬ ‫م ف‬/‫د‬-‫ حان أم ة‬/‫د‬ 10

You might also like