You are on page 1of 15

MS Access

Chapter One

1.1.What Is a Database? ‫ما هي قاعدة البيانات؟‬


A database is information that is set up for easy ‫قاعدة البيانات هي المعلومات التي تم إعدادها من أجل سهولة‬
access, management and updating. .‫الوصول واإلدارة والتحديث‬
Databases are used for storing, maintaining and ‫تُستخدم قواعد البيانات لتخزين وصيانة والوصول إلى أي نوع من‬
accessing any sort of data. They collect information ‫إنهم يجمعون معلومات عن األشخاص أو األماكن أو‬. ‫البيانات‬
on people, places or things. That information is ‫يتم جمع هذه المعلومات في مكان واحد بحيث يمكن مالحظتها‬. ‫األشياء‬
gathered in one place so that it can be observed and ‫يمكن اعتبار قواعد البيانات على أنها مجموعة منظمة من‬. ‫وتحليلها‬
analyzed. Let us discuss a database example: An ‫ يستخدم دليل الهاتف عبر‬:‫دعونا نناقش مثال قاعدة بيانات‬. ‫المعلومات‬
online telephone directory uses a database to store ‫اإلنترنت قاعدة بيانات لتخزين بيانات األشخاص وأرقام الهواتف‬
data of people, phone numbers, and other contact ‫ دعونا نفكر أيضًا في‬.‫وتفاصيل االتصال األخرى‬
details. Let us also consider Facebook. It needs to ‫يحتاج إلى تخزين ومعالجة وتقديم البيانات المتعلقة‬Facebook.
store, manipulate, and present data related to ‫باألعضاء وأصدقائهم وأنشطة األعضاء والرسائل واإلعالنات وغير‬
members, their friends, member activities, messages, .‫ذلك الكثير‬
advertisements, and a lot more.
:‫تعريف البيانات‬
1.2.Definition of Data: ‫ غالبًا‬،‫البيانات هي حقائق فردية أو إحصاءات أو عناصر معلومات‬
Data are individual facts, statistics, or items of ‫ البيانات عبارة عن مجموعة من‬،‫ بمعنى أكثر تقنية‬.‫ما تكون رقمية‬
information, often numeric. In a more technical .‫القيم‬
sense, data are a set of values. ‫ البيانات الكمية هي بيانات‬.‫يمكن أن تكون البيانات كمية أو نوعية‬
.‫رقمية أو نتيجة قياس أو حساب أو بعض الحسابات الرياضية األخرى‬
Data can be quantitative or qualitative.
‫ لون سيارة فورد فوكس‬،"‫ "روبي ريد‬.‫البيانات النوعية وصفية‬
Quantitative data is numeric, the result of a ‫ يمكن أن يكون الرقم نوعيًا‬.‫ هو مثال على البيانات النوعية‬،2013
measurement, count, or some other mathematical ‫ فهذه بيانات نوعية ألنها‬،5 ‫ إذا أخبرتك أن رقمي المفضل هو‬:‫أيضًا‬
calculation. Qualitative data is descriptive. “Ruby .‫وصفية وليست نتيجة قياس أو حساب رياضي‬
Red,” the color of a 2013 Ford Focus, is an example
of qualitative data. A number can be qualitative too:
if I tell you my favorite number is 5, that is
qualitative data because it is descriptive, not the
result of a measurement or mathematical calculation.
MS Access

Chapter Two

2.1 MS Access
Microsoft Access is a Database Management System (DBMS) ‫هو نظام إدارة قواعد بيانات‬Microsoft Access
(DBMS) from Microsoft that combines the relational Microsoft Jet ‫ يجمع بين محرك قاعدة بيانات‬Microsoft ‫من‬
Microsoft Jet Database Engine with a graphical user .‫العالئقية وواجهة مستخدم رسومية وأدوات تطوير برامج‬
interface and software development tools.

2.2 MS Access – Objects ‫ كائنات‬MS Access -


Databases in Access are composed of many objects ‫ من العديد من األشياء ولكن فيما‬Access ‫تتكون قواعد البيانات في‬
but the following are the major objects − -‫يلي األشياء الرئيسية‬

 Tables ‫الجداول‬ 
 Queries ‫استفسارات‬ 
 Forms
‫نماذج‬ 
 Reports
‫التقارير‬ 

2.3 Create a DataBase Table

To create a database from a template, we first need to open MS Access and you will see the
following screen in which different Access database templates are displayed.

‫ وسترى الشاشة التالية التي يتم فيها عرض قوالب قاعدة‬MS Access ‫ نحتاج أوالً إلى فتح‬،‫إلنشاء قاعدة بيانات من قالب‬
.‫ مختلفة‬Access ‫بيانات‬
MS Access

Step 1 − Let us now start by opening MS Access.

MS Access. ‫ لنبدأ اآلن بفتح‬- 1 ‫الخطوة‬

1. Blank desktop Database


MS Access

Step 2 − Select Blank desktop database. Enter the name and click the Create button.

."‫ أدخل االسم وانقر فوق الزر "إنشاء‬.‫ حدد قاعدة بيانات سطح المكتب الفارغة‬- 2 ‫الخطوة‬

Press create
‫اضغط انشاء‬

Select a name for the database


‫اختر اسم قاعدة البيانات‬
The path of directory where
our database is saved

‫مسار المجلد حيث يتم حفظ قاعدة البيانات الخاصة بنا‬


MS Access

Step 3 − Access will create a new blank database and will open up the table which is also
completely blank.

.‫ضا‬
ً ‫ قاعدة بيانات فارغة جديدة وسيفتح الجدول وهو فارغ تما ًما أي‬Access ‫ سينشئ‬- 3 ‫الخطوة‬
MS Access

Table ‫جدول‬
Table is an object that is used to define and store data. ‫ عند إنشاء‬.‫الجدول هو كائن يستخدم لتعريف البيانات وتخزينها‬
When you create a new table, Access asks you to define ‫ تحديد الحقول التي تُعرف أيضًا‬Access ‫ يطلب منك‬،‫جدول جديد‬
fields which is also known as column headings. .‫باسم عناوين األعمدة‬
 Each field must have a unique name, and data .‫ يجب أن يكون لكل حقل اسم فريد ونوع بيانات‬
type. ‫ تحتوي الجداول على حقول أو أعمدة تخزن أنواعًا‬
 Tables contain fields or columns that store ‫ والسجالت‬،‫ مثل االسم أو العنوان‬،‫مختلفة من البيانات‬
different kinds of data, such as a name or an ‫أو الصفوف التي تجمع كل المعلومات حول مثيل‬
address, and records or rows that collect all the ‫ مثل جميع المعلومات حول عميل أو‬،‫معين للموضوع‬
information about a particular instance of the .‫موظف وما إلى ذلك‬
subject, such as all the information about a ‫ واحد أو أكثر من الحقول‬،‫ يمكنك تحديد مفتاح أساسي‬
customer or employee etc. ‫ وفهرس واحد أو أكثر‬،‫التي لها قيمة فريدة لكل سجل‬
 You can define a primary key, one or more ‫في كل جدول للمساعدة في استرداد بياناتك بسرعة‬
fields that have a unique value for each record, .‫أكبر‬
and one or more indexes on each table to help
retrieve your data more quickly.

To modify the fields


‫لتعديل الحقول‬
MS Access

The Datasheet View of a Table allows you to create and modify the data within a grid
structure based on the settings in the Design View.
‫تتيح لك طريقة عرض ورقة البيانات الخاصة بالجدول إنشاء البيانات وتعديلها داخل بنية شبكة استنادًا إلى اإلعدادات في‬
.‫طريقة عرض التصميم‬

Field
‫الحقل‬
record
‫سجل‬
MS Access

Design View
‫صفحة التصميم‬
MS Access

The Design View of a Table allows you to create and modify:


- Field Names (the column headings)
- The type of data stored in a field (Data Type). In this workshop we use:
- Descriptions, which will be displayed in the status bar in the Data view of Forms
- And the Properties of each field, such as how many characters can be
entered (text field size), or how the data is formatted (05/05/15 or May 5,
2015).
MS Access

Type of Data Description Size

Text or combinations of text and Up to 255 characters.


Short Text numbers, including numbers that do not
require calculating (e.g. phone numbers).

Lengthy text or combinations of text and Up to 63, 999 characters.


Long Text
numbers.

Numeric data used in mathematical 1, 2, 4, or 8 bytes (16 bytes if set to


Number
calculations. Replication ID).

Date and time values for the years 100 8 bytes


Date/Time
through 9999.

Currency values and numeric data used in 8 bytes


Currency mathematical calculations involving data
with one to four decimal places.

A unique sequential (incremented by 1) 4 bytes (16 bytes if set to Replication


number or random number assigned by ID).
AutoNumber
Microsoft Access whenever a new record
is added to a table.

Yes and No values and fields that contain 1 bit.


Yes/No only one of two values (Yes/No,
True/False, or On/Off).

Files, such as digital photos. Multiple Up to about 2 GB.


files can be attached per record. This data
Attachment
type is not available in earlier versions of
Access.
MS Access

OLE objects can store pictures, audio, Up to about 2 GB.


OLE objects video, or other BLOBs (Binary Large
Objects)

Text or combinations of text and numbers Up to 8,192 (each part of a


Hyperlink stored as text and used as a hyperlink Hyperlink data type can contain up
address. to 2048 characters).

The Lookup Wizard entry in the Data Dependent on the data type of the
Type column in the Design view is not lookup field.
actually a data type. When you choose
this entry, a wizard starts to help you
define either a simple or complex lookup
field.
Lookup Wizard
A simple lookup field uses the contents of
another table or a value list to validate the
contents of a single value per row. A
complex lookup field allows you to store
multiple values of the same data type in
each row.

You can create an expression that uses You can create an expression that
data from one or more fields. You can uses data from one or more fields.
Calculated
designate different result data types from You can designate different result
the expression. data types from the expression.

‫نوع البيانات‬ ‫وصف‬ ‫بحجم‬

‫ بما في ذلك األرقام‬، ‫نص أو مجموعات من النصوص واألرقام‬ .‫ حرفًا‬255 ‫ما يصل إلى‬
‫نص قصير‬
.)‫التي ال تتطلب حسابًا (مثل أرقام الهواتف‬

‫نص طويل‬ .‫نص مطول أو مجموعات من النصوص واألرقام‬ .‫ حرفًا‬63،999 ‫ما يصل إلى‬

.‫البيانات الرقمية المستخدمة في الحسابات الرياضية‬ ‫ بايت إذا تم‬16( ‫ بايت‬8 ‫ أو‬4 ‫ أو‬2 ‫أو‬1
‫عدد‬
.)‫معرف النسخ المتماثل‬
ّ ‫تعيينها على‬
‫‪MS Access‬‬

‫التاريخ ‪ /‬الوقت‬ ‫قيم التاريخ والوقت للسنوات من ‪ 100‬إلى ‪.9999‬‬ ‫‪8‬بايت‬

‫قيم العمالت والبيانات الرقمية المستخدمة في العمليات الحسابية‬ ‫‪8‬بايت‬


‫عملة‬
‫التي تتضمن بيانات من واحد إلى أربعة منازل عشرية‪.‬‬

‫رقم تسلسلي فريد (يزداد بمقدار ‪ )1‬أو رقم عشوائي يتم تعيينه‬ ‫‪4‬بايت (‪ 16‬بايت إذا تم تعيينه على‬
‫رقم تلقائي‬ ‫بواسطة ‪ Microsoft Access‬كلما تمت إضافة سجل جديد إلى‬ ‫معرف النسخ المتماثل)‪.‬‬
‫جدول‪.‬‬

‫نعم وال قيم وحقول تحتوي على واحدة فقط من قيمتين (نعم ‪ /‬ال ‪،‬‬ ‫‪1‬بت‪.‬‬
‫نعم ‪ /‬ال‬
‫صواب ‪ /‬خطأ ‪ ،‬أو تشغيل ‪ /‬إيقاف)‪.‬‬

‫إذا كنت تستخدم‬ ‫الملفات ‪ ،‬مثل الصور الرقمية ‪.‬يمكن إرفاق ملفات متعددة لكل‬ ‫ما يصل إلى حوالي ‪ 2‬جيجا بايت‪.‬‬
‫إصدارات سابقة‬ ‫سجل ‪.‬نوع البيانات هذا غير متوفر في اإلصدارات السابقة من‬
‫مرفق‬ ‫‪Access.‬‬

‫يمكن أن تقوم كائنات ‪ OLE‬بتخزين الصور أو الصوت أو الفيديو‬ ‫ما يصل إلى حوالي ‪ 2‬جيجا بايت‪.‬‬
‫كائنات‪OLE‬‬
‫أو كائنات ‪ BLOB‬أخرى (كائنات ثنائية كبيرة)‬

‫نص أو مجموعات من النصوص واألرقام مخزنة كنص‬ ‫ما يصل إلى ‪( 8192‬يمكن أن يحتوي كل‬
‫ارتباط تشعبي‬ ‫ومستخدمة كعنوان ارتباط تشعبي‪.‬‬ ‫جزء من نوع بيانات االرتباط التشعبي‬
‫على ما يصل إلى ‪ 2048‬حرفًا)‪.‬‬

‫إدخال "معالج البحث" في العمود "نوع البيانات" في طريقة‬ ‫يعتمد على نوع بيانات حقل البحث‪.‬‬
‫العرض "تصميم" ليس في الواقع نوع بيانات ‪.‬عند اختيار هذا‬
‫اإلدخال‪ ،‬يبدأ المعالج في مساعدتك على تحديد حقل بحث بسيط‬
‫أو معقد‪.‬‬
‫معالج البحث‬
‫يستخدم حقل البحث البسيط محتويات جدول آخر أو قائمة قيم‬
‫للتحقق من صحة محتويات قيمة واحدة لكل صف ‪.‬يسمح لك حقل‬
‫البحث المعقد بتخزين قيم متعددة من نفس نوع البيانات في كل‬
‫صف‪.‬‬

‫يمكنك إنشاء تعبير يستخدم بيانات من‬


‫يمكنك إنشاء تعبير يستخدم بيانات من حقل واحد أو أكثر ‪.‬يمكنك‬
‫محسوب‬ ‫حقل واحد أو أكثر ‪.‬يمكنك تعيين أنواع‬
‫تعيين أنواع بيانات نتائج مختلفة من التعبير‪.‬‬
‫بيانات نتائج مختلفة من التعبير‪.‬‬
MS Access

Important Field Properties ‫خصائص الحقل الهامة‬

Field Size Text fields: The maximum number of ‫ الحد األقصى لعدد األحرف (حتى‬:‫الحقول النصية‬ ‫حجم الحقل‬
characters (up to 255) that can be entered ‫ اإلعداد‬.‫) التي يمكن إدخالها في الحقل‬255
in the field. The default setting is 50. .50 ‫االفتراضي هو‬

Number / Currency fields: Stores the ‫ يخزن الرقم على هيئة بايت أو‬:‫ العملة‬/ ‫حقول الرقم‬
number as a Byte, Integer, Long Integer, ‫عدد صحيح أو عدد صحيح طويل أو مفرد أو مزدوج‬
Single, Double, or Replication ID. The ‫ اإلعداد االفتراضي هو عدد‬.‫معرف النسخ المتماثل‬ّ ‫أو‬
default setting is Long Integer. .‫صحيح طويل‬

Format How the data in the field will be displayed ‫كيف سيتم عرض البيانات الموجودة في الحقل على‬ ‫صيغة‬
on the screen. .‫الشاشة‬
Input Mask Creates a format or pattern in which data ً ً
.‫ينشئ تنسيقا أو نمطا يجب إدخال البيانات به‬ ‫قناع‬
must be entered. ‫اإلدخال‬
Decimal The number of decimal places in Number ".‫عدد المنازل العشرية في حقلي "الرقم" و "العملة‬ ‫منازل‬
Places and Currency fields. ‫عشرية‬
Caption A label for the field that will appear on ‫ إذا لم تُدخل‬.‫تسمية للحقل الذي سيظهر في النماذج‬ ‫التسمية‬
forms. If you don't enter a caption, Access ‫ اسم الحقل‬Access ‫ فسيستخدم‬، ‫تسمية توضيحية‬ ‫التوضيحية‬
will use the field name as the caption. .‫كتسمية توضيحية‬
Default A value that Access enters automatically ‫ بإدخالها تلقائيًا في الحقل للسجالت‬Access ‫قيمة يقوم‬ ‫القيمة‬
Value in the field for new records. ‫الجديدة‬ ‫االفتراضية‬
Validation An expression that limits the values that .‫تعبير يحد من القيم التي يمكن إدخالها في الحقل‬ ‫قاعدة‬
Rule can be entered in the field. ‫التحقق من‬
‫الصحة‬
Validation The error message that appears when an ‫رسالة الخطأ التي تظهر عند إدخال قيمة غير صحيحة‬ ‫نص‬
Text incorrect or restricted value is entered in a .‫أو مقيدة في حقل بقاعدة التحقق من الصحة‬ ‫التحقق من‬
field with a validation rule. ‫الصحة‬
Required Specify whether or not a value must be .‫حدد ما إذا كان يجب إدخال قيمة في الحقل أم ال‬ ‫مطلوب‬
entered in the field. The default is No. .‫االفتراضي هو ال‬
Allow Zero Specify whether or not the field allows ‫حدد ما إذا كان الحقل يسمح بالسالسل النصية ذات‬ ‫السماح‬
Length zero-length text strings .)‫الطول الصفري أم ال (سلسلة ال تحتوي على أحرف‬ ‫بطول الصفر‬
‫تعتبر السالسل النصية ذات الطول الصفري مفيدة إذا‬
‫ ولكن ال‬، ‫كان يجب عليك إدخال البيانات في حقل‬
.‫توجد بيانات‬
Indexed Specify whether or not you want to index ‫حدد ما إذا كنت تريد فهرسة الحقل أم ال لتسريع‬ ‫مفهرسة‬
the field to speed up searches and sorts ‫عمليات البحث والفرز التي يتم إجراؤها في الحقل أم‬
performed on the field. The default is No. .‫ االفتراضي هو ال‬.‫ال‬
MS Access

Primary Key:
A primary key is used to ensure data in the specific column is unique. It is a column cannot have
NULL values. It is either an existing table column or a column that is specifically generated by the
database according to a defined sequence.

:‫المفتاح األساسي‬
.‫ إنه عمود ال يمكن أن يحتوي على قيم فارغة‬.‫يُستخدم المفتاح األساسي للتأكد من أن البيانات الموجودة في العمود المحدد فريدة‬
.‫صا بواسطة قاعدة البيانات وفقًا لتسلسل محدد‬
ً ‫إنه إما عمود جدول موجود أو عمود تم إنشاؤه خصي‬

Foreign Key:
A foreign key is a column or group of columns in a relational database table that provides a link
between data in two tables. It is a column (or columns) that references a column (most often the
primary key) of another table.

:‫المفتاح الثانوي‬
ً
‫ إنه‬.‫المفتاح الثانوي هو عمود أو مجموعة من األعمدة في جدول قاعدة بيانات عالئقية يوفر ارتباطا بين البيانات في جدولين‬
.‫عمود (أو أعمدة) يشير إلى عمود (غالبًا المفتاح األساسي) لجدول آخر‬

Primary key
‫مفتاح أساسي‬

Foreign key
‫مفتاح ثانوي‬

In a relational database (Access), the data in one table is related to the data in other tables. In
general, tables can be related in one of three different ways: one-to-one, one-to-many or many-to-
many. The relationship is used to cross reference information between tables.

‫ بشكل‬.‫ ترتبط البيانات الموجودة في أحد الجداول بالبيانات الموجودة في جداول أخرى‬، (Access)‫في قاعدة البيانات العالئقية‬
‫ يتم استخدام العالقة‬.‫ أو متعدد بأطراف‬،‫ أو رأس بأطراف‬،‫ واحد لواحد‬:‫ يمكن ربط الجداول بإحدى الطرق الثالث المختلفة‬،‫عام‬
.‫لمراجع مرجعية للمعلومات بين الجداول‬
‫‪MS Access‬‬

‫‪One to One‬‬
‫‪In a one-to-one relationship each record in one table has at most one related record in another‬‬
‫‪table. In a one-to-one relationship, each record in Table A can have only one matching record in‬‬
‫‪Table B, and each record in Table B can have only one matching record in Table A.‬‬

‫واحد لواحد‬
‫في عالقة واحد لواحد‪ ،‬يكون لكل سجل في جدول واحد على األكثر سجل مرتبط في جدول آخر‪ .‬في عالقة رأس واحد لواحد‪،‬‬
‫يمكن أن يحتوي كل سجل في الجدول أ على سجل واحد مطابق فقط في الجدول ب‪ ،‬ويمكن أن يحتوي كل سجل في الجدول ب على‬
‫سجل واحد مطابق فقط في الجدول أ‪.‬‬

‫‪One to Many‬‬
‫‪A one-to-many relationship, often referred to as a "master-detail" or "parent-child" relationship.‬‬
‫‪A one-to-many relationship is the most common type of relationship. In a one-to-many relationship,‬‬
‫‪a record in Table A can have many matching records in Table B, but a record in Table B has only‬‬
‫‪one matching record in Table A.‬‬

‫واحد لكثير‬
‫عالقة واحد لكثير‪ ،‬يشار إليها غالبًا بعالقة "رئيسي‪-‬تفصيلي" أو عالقة "أصل‪-‬طفل‪ ".‬عالقة واحد لكثير هي أكثر أنواع‬
‫العالقات شيوعًا‪ .‬في عالقة واحد لكثير‪ ،‬يمكن أن يحتوي السجل في الجدول أ على العديد من السجالت المطابقة في الجدول ب‪،‬‬
‫ولكن السجل الموجود في الجدول ب يحتوي على سجل مطابق واحد فقط في الجدول أ‪.‬‬

‫‪Many to Many‬‬
‫‪In a many-to-many relationship, a record in Table A can have many matching records in Table‬‬
‫‪B, and a record in Table B can have many matching records in Table A.‬‬

‫الكثير للكثيرين‬
‫في عالقة أطراف بأطراف‪ ،‬يمكن أن يحتوي السجل في الجدول أ على العديد من السجالت المطابقة في الجدول ب‪ ،‬ويمكن أن‬
‫يحتوي السجل في الجدول ب على العديد من السجالت المطابقة في الجدول أ‪ .‬هذا النوع من العالقات ممكن فقط من خالل تعريف‬
‫جدول ثالث (يسمى جدول الوصالت) الذي يتكون مفتاحه األساسي من حقلين ‪ -‬المفاتيح الخارجية من الجدولين أ و ب‪ .‬عالقة‬
‫أطراف بأطراف هي في الحقيقة عالقتان رأس بأطراف مع جدول ثالث‪.‬‬

You might also like