Professional Documents
Culture Documents
ADBMS - Chapter 01
ADBMS - Chapter 01
(DBMS)
Chapter 1
Objectives اﻷھﺪاف
• Develop an understanding of the purpose of database systems
• Describe the purpose and contents of an entity-relationship model
• Explain the steps in the normalization process
• Describe the differences between personal and client/server databases
• Understand the Northwoods University student registration database and the
Clearwater Traders sales order database
.ﺗﻄﻮﯾﺮ ﻓﮭﻢ ﻟﻐﺮض ﻧﻈﻢ ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت
.ﻧﺼﻒ اﻟﻐﺮض وﻣﺤﺘﻮﯾﺎت ﻧﻤﻮذج ﻋﻼﻗﺔ اﻟﻜﯿﺎن
.اﺷﺮح اﻟﺨﻄﻮات ﻓﻲ ﻋﻤﻠﯿﺔ اﻟﺘﻄﺒﯿﻊ
. اﻟﺨﺎدم/ وﺻﻒ اﻻﺧﺘﻼﻓﺎت ﺑﯿﻦ ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت اﻟﺸﺨﺼﯿﺔ واﻟﻌﻤﯿﻞ
Clearwater Traders وﻗﺎﻋﺪة ﺑﯿﺎﻧﺎت أواﻣﺮ ﻣﺒﯿﻌﺎتNorthwoods ﻓﮭﻢ ﻗﺎﻋﺪة ﺑﯿﺎﻧﺎت ﺗﺴﺠﯿﻞ اﻟﻄﻼب ﺑﺠﺎﻣﻌﺔ
Introduction
اﻟﻤﻘﺪﻣﺔ
If an organization needs to store and maintain a large amount of data that must be viewed and
updated by many users at the same time, it often uses a client/server database such as Oracle
10g.
إذا اﺣﺘﺎﺟﺖ اﻟﻤﺆﺳﺴﺔ إﻟﻰ ﺗﺨﺰﯾﻦ وﺻﯿﺎﻧﺔ ﻛﻤﯿﺔ ﻛﺒﯿﺮة ﻣﻦ اﻟﺒﯿﺎﻧﺎت اﻟﺘﻲ ﯾﺠﺐ ﻋﺮﺿﮭﺎ وﺗﺤﺪﯾﺜﮭﺎ ﻣﻦ ﻗﺒﻞ اﻟﻌﺪﯾﺪ ﻣﻦ
اﻟﺨﺎدم ﻣﺜﻞ/ ﻓﻐﺎﻟﺒًﺎ ﻣﺎ ﺗﺴﺘﺨﺪم ﻗﺎﻋﺪة ﺑﯿﺎﻧﺎت اﻟﻌﻤﯿﻞ،اﻟﻤﺴﺘﺨﺪﻣﯿﻦ ﻓﻲ ﻧﻔﺲ اﻟﻮﻗﺖOracle 10g.
Database Systems
ﻧﻈﻢ ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت
• Data files consist of: ﺗﺘﻜﻮن ﻣﻠﻔﺎت اﻟﺒﯿﺎﻧﺎت ﻣﻦ
– Fields اﻟﺤﻘﻮل
• Describe characteristics وﺻﻒ اﻟﺨﺼﺎﺋﺺ
• Also called columns وﺗﺴﻤﻰ أﯾﻀﺎ اﻷﻋﻤﺪة
– Records اﻟﺴﺠﻼت
• Group of related fields ﻣﺠﻤﻮﻋﺔ ﻣﻦ اﻟﺤﻘﻮل ذات اﻟﺼﻠﺔ
• Problems with storing data in files:
:ﻣﺸﺎﻛﻞ ﻓﻲ ﺗﺨﺰﯾﻦ اﻟﺒﯿﺎﻧﺎت ﻓﻲ اﻟﻤﻠﻔﺎت
– Proliferation of data management programs
اﻧﺘﺸﺎر ﺑﺮاﻣﺞ إدارة اﻟﺒﯿﺎﻧﺎت
– Presence of redundant data وﺟﻮد ﺑﯿﺎﻧﺎت زاﺋﺪة ﻋﻦ اﻟﺤﺎﺟﺔ
– Inconsistent data ﺑﯿﺎﻧﺎت ﻏﯿﺮ ﻣﺘﻨﺎﺳﻘﺔ
• Database ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت
– Stores all organizational data in central location
ﯾﺨﺰن ﺟﻤﯿﻊ اﻟﺒﯿﺎﻧﺎت اﻟﺘﻨﻈﯿﻤﯿﺔ ﻓﻲ ﻣﻮﻗﻊ ﻣﺮﻛﺰي
– Eliminates redundant data to reduce possibility of inconsistent data
ﯾﺰﯾﻞ اﻟﺒﯿﺎﻧﺎت اﻟﻤﺘﻜﺮرة ﻟﻠﺤﺪ ﻣﻦ اﺣﺘﻤﺎل وﺟﻮد ﺑﯿﺎﻧﺎت ﻏﯿﺮ ﻣﺘﺴﻘﺔ
• Database management system (DBMS)
ﻧﻈﺎم إدارة ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت
– Application that performs all routine data-handling operations
وھﻮ اﻟﺘﻄﺒﯿﻖ اﻟﺬي ﯾﻨﻔﺬ ﺟﻤﯿﻊ ﻋﻤﻠﯿﺎت ﻣﻌﺎﻟﺠﺔ اﻟﺒﯿﺎﻧﺎت اﻟﺮوﺗﯿﻨﯿﺔ
– Provides central set of common functions for managing database
:ﯾﻮﻓﺮ ﻣﺠﻤﻮﻋﺔ ﻣﺮﻛﺰﯾﺔ ﻣﻦ اﻟﻮظﺎﺋﻒ اﻟﺸﺎﺋﻌﺔ ﻹدارة ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت
• Inserting ادﺧﺎل
• Updating ﺗﺤﺪﯾﺚ
• Retrieving اﺳﺘﺮﺟﺎع
• Deleting data values ﺣﺬف ﻗﯿﻢ اﻟﺒﯿﺎﻧﺎت
Primary Keys
اﻟﻤﻔﺎﺗﯿﺢ اﻷﺳﺎﺳﯿﺔ
• Column in relational database table whose value must be unique for each row
ھﻮ ﻋﻤﻮد ﻓﻲ ﺟﺪول ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت اﻟﻌﻼﺋﻘﯿﺔ اﻟﺬي ﯾﺠﺐ أن ﺗﻜﻮن ﻗﯿﻤﺘﮫ ﻓﺮﯾﺪة ﻟﻜﻞ ﺻﻒ
• Serves to identify individual occurrence of entity
ﯾﺨﺪم ﻟﺘﺤﺪﯾﺪ اﻟﺘﻮاﺟﺪ اﻟﻔﺮدي ﻟﻠﻜﯿﺎن
• Every row must have a primary key ﯾﺠﺐ أن ﯾﻜﻮن ﻟﻜﻞ ﺻﻒ ﻣﻔﺘﺎح أﺳﺎﺳﻲ
• Cannot be NULL ﻻ ﯾﻤﻜﻦ أن ﺗﻜﻮن ﻻﻏﯿﺔ أو ﻋﺪﻣﺎ او ﻓﺎرﻏﺎ
• NULL ﻻ ﺷﻲء
– Value is absent or unknown اﻟﻘﯿﻤﺔ ﻏﺎﺋﺒﺔ أو ﻏﯿﺮ ﻣﻌﺮوﻓﺔ
– No entry is made for that data elementﻻ ﯾﻮﺟﺪ إدﺧﺎل ﻟﻌﻨﺼﺮ اﻟﺒﯿﺎﻧﺎت ھﺬا
Candidate Keys
اﻟﻤﻔﺎﺗﯿﺢ اﻟﻤﺮﺷﺤﺔ
• Any column that could be used as the primary key
أي ﻋﻤﻮد ﯾﻤﻜﻦ اﺳﺘﺨﺪاﻣﮫ ﻛﻤﻔﺘﺎح أﺳﺎﺳﻲ
• Should be a column that is unique for each record and does not change
ﯾﺠﺐ أن ﯾﻜﻮن ﻋﻤﻮدًا ﻓﺮﯾﺪًا ﻟﻜﻞ ﺳﺠﻞ وﻻ ﯾﺘﻐﯿﺮ
Surrogate Keys
ﻣﻔﺎﺗﯿﺢ ﺑﺪﯾﻠﺔ
• Column created to be record’s primary key identifier
ﺗﻢ إﻧﺸﺎء اﻟﻌﻤﻮد ﻟﯿﻜﻮن ﻣﻌﺮف اﻟﻤﻔﺘﺎح اﻷﺳﺎﺳﻲ ﻟﻠﺴﺠﻞ
• Has no real relationship to row to which it is assigned other than to identify it
uniquely
ﻟﯿﺲ ﻟﮫ ﻋﻼﻗﺔ ﺣﻘﯿﻘﯿﺔ ﺑﺎﻟﺼﻒ اﻟﺬي ﺗﻢ ﺗﻌﯿﯿﻨﮫ ﻟﮫ ﺑﺨﻼف ﺗﺤﺪﯾﺪه ﺑﺸﻜﻞ ﻓﺮﯾﺪ
• Surrogate key values automatically generated using a sequence
ﻗﯿﻢ ﻣﻔﺎﺗﯿﺢ اﻟﺒﺪﯾﻞ اﻟﺮﺋﯿﺴﯿﺔ ﯾﺘﻢ إﻧﺸﺎؤھﺎ ﺗﻠﻘﺎﺋﯿﺎ ﺑﺎﺳﺘﺨﺪام ﺗﺴﻠﺴﻞ
Foreign Keys
ﻣﻔﺎﺗﯿﺢ ﺧﺎرﺟﯿﺔ او اﺟﻨﺒﯿﺔ
• Column in table that is a primary key in another table
اﻟﻌﻤﻮد ﻓﻲ اﻟﺠﺪول ھﻮ ﻣﻔﺘﺎح أﺳﺎﺳﻲ ﻓﻲ ﺟﺪول آﺧﺮ
• Creates relationship between two tables ﯾﻮﺟﺪ اﻟﻌﻼﻗﺔ ﺑﯿﻦ ﺟﺪوﻟﯿﻦ
• Value must exist in table where it is the primary key
ﯾﺠﺐ أن ﺗﻜﻮن اﻟﻘﯿﻤﺔ ﻣﻮﺟﻮدة ﻓﻲ اﻟﺠﺪول ﺣﯿﺚ ﯾﻜﻮن اﻟﻤﻔﺘﺎح اﻷﺳﺎﺳﻲ
Database Design
ﺗﺼﻤﯿﻢ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت
Main tasks involved with design of database: اﻟﻤﮭﺎم اﻟﺮﺋﯿﺴﯿﺔ اﻟﺘﻲ ﺗﺸﺎرك ﻣﻊ ﺗﺼﻤﯿﻢ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت
– Developing entity-relationship (ER) model ﺗﻄﻮﯾﺮ ﻧﻤﻮذج اﻟﻌﻼﻗﺔ ﺑﯿﻦ اﻟﻜﯿﺎن
– Normalizing database tables ﺗﺴﻮﯾﺔ ﺟﺪاول ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت وﺟﻌﻠﮭﺎ طﺒﯿﻌﯿﺔ
Entity-Relationship Model
ﻧﻤﻮذج اﻟﻌﻼﻗﺔ ﺑﯿﻦ اﻟﻜﯿﺎن
• Designed to help you identify which entities need to be included in database
.ﻣﺼﻤﻤﺔ ﻟﻤﺴﺎﻋﺪﺗﻚ ﻓﻲ ﺗﺤﺪﯾﺪ أي اﻟﻜﯿﺎﻧﺎت ﺗﺤﺘﺎج إﻟﻰ أن ﺗﺪرج ﻓﻲ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت
• Composed of :ﺗﺘﻜﻮن ﻣﻦ
– Squares representing entities اﻟﻤﺮﺑﻌﺎت اﻟﺘﻲ ﺗﻤﺜﻞ اﻟﻜﯿﺎﻧﺎت
– Lines representing relationshipsﺧﻄﻮط ﺗﻤﺜﻞ اﻟﻌﻼﻗﺎت
• Types of relationships: :أﻧﻮاع اﻟﻌﻼﻗﺎت
– One to one (1:1)
– One to many (1:M)
– Many to many (N:M)
• One to one (1:1)
– Each occurrence of a specific entity is found only once in each set of data
ﺗﻢ اﻟﻌﺜﻮر ﻋﻠﻰ ﻛﻞ ﺗﻮاﺟﺪ ﻟﻜﯿﺎن ﻣﻌﯿﻦ ﻣﺮة واﺣﺪة ﻓﻘﻂ ﻓﻲ ﻛﻞ ﻣﺠﻤﻮﻋﺔ ﻣﻦ اﻟﺒﯿﺎﻧﺎت
– Rare in relational databasesﯾﻜﻮن ﻧﺎدر ﻓﻲ ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت اﻟﻌﻼﺋﻘﯿﺔ
• One to many (1:M)
– Instance can only appear once in one entity, but one or more times in the other entity
وﻟﻜﻦ ﻣﺮة واﺣﺪة أو أﻛﺜﺮ ﻓﻲ اﻟﻜﯿﺎن اﻵﺧﺮ،ﯾﻤﻜﻦ أن ﯾﻈﮭﺮ اﻟﻤﺜﯿﻞ ﻣﺮة واﺣﺪة ﻓﻘﻂ ﻓﻲ ﻛﯿﺎن واﺣﺪ
• Many to many (N:M)
– Instance can occur multiple times in each entity ﯾﻤﻜﻦ أن ﯾﺤﺪث ﻣﺜﯿﻞ ﻋﺪة ﻣﺮات ﻓﻲ ﻛﻞ ﻛﯿﺎن
– Cannot be represented in physical database ﻻ ﯾﻤﻜﻦ ﺗﻤﺜﯿﻠﮫ ﻓﻲ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت اﻟﻔﻌﻠﯿﺔ
– Broken down into series of two or more 1:M relationships through use of linking table
in process of normalization
( ﻣﻦ ﺧﻼل اﺳﺘﺨﺪام ﺟﺪول اﻟﺮﺑﻂ ﻓﻲ ﻋﻤﻠﯿﺔ اﻟﺘﻄﺒﯿﻊ )ﺗﻜﻮﯾﻦ ﺟﺪول ﺛﺎﻟﺚM:1 ﻣﻘﺴﻤﺔ إﻟﻰ ﺳﻠﺴﻠﺔ ﻣﻦ ﻋﻼﻗﺘﯿﻦ أو أﻛﺜﺮ
Normalization ﺗﻄﺒﯿﻊ
• Step-by-step process used to determine which data elements should be stored in which
tables ﻋﻤﻠﯿﺔ ﺧﻄﻮة ﺑﺨﻄﻮة ﺗ ُﺴﺘﺨﺪم ﻟﺘﺤﺪﯾﺪ ﻋﻨﺎﺻﺮ اﻟﺒﯿﺎﻧﺎت اﻟﺘﻲ ﯾﻨﺒﻐﻲ ﺗﺨﺰﯾﻨﮭﺎ ﻓﻲ اﻟﺠﺪاول
• Purpose اﻟﮭﺪف
– Eliminate data redundancy اﻟﻘﻀﺎء ﻋﻠﻰ اﻟﺘﻜﺮار اﻟﺒﯿﺎﻧﺎت
• Several levels of normalization ﯾﻮﺟﺪ ﻋﺪة ﻣﺴﺘﻮﯾﺎت ﻣﻦ اﻟﺘﻄﺒﯿﻊ
– Forms ﻧﻤﺎذج
• Unnormalized data ﺑﯿﺎﻧﺎت ﻏﯿﺮ طﺒﯿﻌﯿﺔ
– Does not have a primary key identified ﻟﻢ ﯾﺘﻢ ﺗﺤﺪﯾﺪ ﻣﻔﺘﺎح أﺳﺎﺳﻲ
– Contains repeating groups ﯾﺤﺘﻮي ﻋﻠﻰ ﻣﺠﻤﻮﻋﺎت ﻣﺘﻜﺮرة
• First normal form (1NF) أول ﻧﻤﻮذج ﻋﺎدي
– Repeating groups removed ﻣﺠﻤﻮﻋﺎت ﻣﺘﻜﺮرة ﯾﺘﻢ إزاﻟﺘﮭﺎ
– Primary key field identified ﺗﻢ ﺗﺤﺪﯾﺪ ﺣﻘﻞ اﻟﻤﻔﺘﺎح اﻟﺮﺋﯿﺴﻲ
• Second normal form (2NF) اﻟﻨﻤﻮذج اﻟﻌﺎدي اﻟﺜﺎﻧﻲ
– In 1NF ﻧﻜﻮن ﻓﻲ
– No partial dependencies ﻻ ﯾﻮﺟﺪ اﻟﺘﺒﻌﯿﺎت اﻟﺠﺰﺋﯿﺔ
• Partial dependency :اﻟﺘﺒﻌﯿﺔ اﻟﺠﺰﺋﯿﺔ ھﻲ
– Fields within the table are dependent only on part of the primary key
ﺗﻌﺘﻤﺪ اﻟﺤﻘﻮل اﻟﻤﻮﺟﻮدة ﻓﻲ اﻟﺠﺪول ﻓﻘﻂ ﻋﻠﻰ ﺟﺰء ﻣﻦ اﻟﻤﻔﺘﺎح اﻷﺳﺎﺳﻲ
• Basic procedure for identifying partial dependency: اﻹﺟﺮاء اﻷﺳﺎﺳﻲ ﻟﺘﺤﺪﯾﺪ اﻟﺘﺒﻌﯿﺔ اﻟﺠﺰﺋﯿﺔ
– Look at each field that is not part of the composite primary key
اﻧﻈﺮ إﻟﻰ ﻛﻞ ﺣﻘﻞ ﻟﯿﺲ ﺟﺰًءا ﻣﻦ اﻟﻤﻔﺘﺎح اﻷﺳﺎﺳﻲ اﻟﻤﺮﻛﺐ
– Make certain you are required to have both parts of the composite field to
determine the value of the data element ﺗﺄﻛﺪ أﻧﻚ ﻣﻄﺎﻟﺐ ﺑﺎﻣﺘﻼك ﺟﺰأﯾﻦ ﻣﻦ اﻟﺤﻘﻞ
اﻟﻤﺮﻛﺐ ﻟﺘﺤﺪﯾﺪ ﻗﯿﻤﺔ ﻋﻨﺼﺮ اﻟﺒﯿﺎﻧﺎت
• Third normal form (3NF)
– In 2NF ﻧﻜﻮن ﻓﻲ
– No transitive dependencies ﻻ ﺗﺒﻌﯿﺎت ﻣﺘﻌﺪﯾﺔ
• Transitive dependency اﻟﺘﺒﻌﯿﺔ ﻣﺘﻌﺪﯾﺔ
– Field is dependent on another field within the table that is not the primary key
field ﯾﻌﺘﻤﺪ اﻟﺤﻘﻞ ﻋﻠﻰ ﺣﻘﻞ آﺧﺮ ﻓﻲ اﻟﺠﺪول ﻟﯿﺲ ﺣﻘﻞ اﻟﻤﻔﺘﺎح اﻷﺳﺎﺳﻲ
Database Systems ﻧﻈﻢ ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت
• Consists of ﯾﺘﻜﻮن ﻣﻦ
– DBMS ﻧﻈﺎم ادارة ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت
• Manages physical storage and data retrieval
ﯾﺪﯾﺮ اﻟﺘﺨﺰﯾﻦ اﻟﻔﻌﻠﻲ واﺳﺘﺮﺟﺎع اﻟﺒﯿﺎﻧﺎت
– Database applications ﺗﻄﺒﯿﻘﺎت ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت
• Provide interface that allows users to interact with database
ﺗﻮﻓﯿﺮ واﺟﮭﺔ ﺗﺴﻤﺢ ﻟﻠﻤﺴﺘﺨﺪﻣﯿﻦ ﺑﺎﻟﺘﻔﺎﻋﻞ ﻣﻊ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت
• Server اﻟﺨﺎدم
– Computer that shares resources with other computers
وھﻮ اﻟﻜﻤﺒﯿﻮﺗﺮ اﻟﺬي ﯾﺸﺎرك اﻟﻤﻮارد ﻣﻊ أﺟﮭﺰة اﻟﻜﻤﺒﯿﻮﺗﺮ اﻷﺧﺮى
• Server process ﻋﻤﻠﯿﺔ اﻟﺨﺎدم
– Program that listens for requests for resources from clients اﻟﺒﺮﻧﺎﻣﺞ اﻟﺬي ﯾﺴﺘﻤﻊ
ﻟﻄﻠﺒﺎت اﻟﻤﻮارد ﻣﻦ اﻟﻌﻤﻼء
– Responds to requests ﯾﺴﺘﺠﯿﺐ ﻟﻠﻄﻠﺒﺎت
• Client زﺑﻮن
– Program that requests and uses server resources
اﻟﺒﺮﻧﺎﻣﺞ اﻟﺬي ﯾﻄﻠﺐ وﯾﺴﺘﺨﺪم ﻣﻮارد اﻟﺨﺎدم
Summary
• Relational databases
– Store data in tabular format
– Create relationships that
link related data using key columns
• Primary key
– Column that uniquely identifies specific record
• Foreign key
– Creates relationship between two tables
• Entity-relationship (ER) model
– Used to describe types of relationships between entities
• Normalization process
– Used to determine which fields belong in which tables
• Database system consists of
– DBMS
– Database applications
• Client/server databases divide database into
– Server process that runs on network server
– User application processes that run on individual client workstations
• Oracle 10g is a client/server database