Advanced Database Management Systems
Advanced Database Management Systems
(DBMS)
Introduction
The Database Environment
Objectives
n Definition of terms
n Explain growth and importance of databases
n Name limitations of conventional file processing
n Identify five categories of databases
n Explain advantages of databases
n Identify costs and risks of databases
n List components of database environment
n Describe evolution of database systems
Definitions
n Database: organized collection of logically related data. ﻣﺠﻤﻮﻋﺔ ﻣﻨﻈﻤﺔ ﻣﻦ اﻟﺒﯿﺎﻧﺎت اﻟﻤﻨﻄﻘﯿﺔ
n Data: stored representations of meaningful objects and events
ﺗﻤﺜﯿﻼت ﻣﺨﺰﻧﺔ ﻷﺷﯿﺎء وأﺣﺪاث ذات ﻣﻐﺰى
n Structured: numbers, text, dates ﻣﺜﻞ اﻷرﻗﺎم واﻟﻨﺼﻮص واﻟﺘﻮارﯾﺦ:ﻣﮭﯿﻜﻠﺔ
n Unstructured: images, video, documents ﻣﺜﻞ اﻟﺼﻮر واﻟﻔﯿﺪﯾﻮ واﻟﻮﺛﺎﺋﻖ:ﻏﯿﺮ ﻣﮭﯿﻜﻠﺔ
n Information: data processed to increase knowledge in the person using the data
. ﻣﻌﺎﻟﺠﺔ اﻟﺒﯿﺎﻧﺎت ﻟﺰﯾﺎدة اﻟﻤﻌﺮﻓﺔ ﻟﺪى اﻟﺸﺨﺺ اﻟﺬي ﯾﺴﺘﺨﺪم اﻟﺒﯿﺎﻧﺎت:اﻟﻤﻌﻠﻮﻣﺎت
n Metadata: data that describes the properties and context of user data
اﻟﺒﯿﺎﻧﺎت اﻟﺘﻲ ﺗﺼﻒ ﺧﺼﺎﺋﺺ وﺳﯿﺎق ﺑﯿﺎﻧﺎت اﻟﻤﺴﺘﺨﺪم
Descriptions of the properties or characteristics of the data, including data types, field sizes,
allowable values, and data context
Disadvantages of File Processing ﻋﯿﻮب ﻣﻌﺎﻟﺠﺔ اﻟﻤﻠﻔﺎت
n Program-Data Dependence ﺑﺮﻧﺎﻣﺞ اﻻﻋﺘﻤﺎد ﻋﻠﻰ اﻟﺒﯿﺎﻧﺎت
n All programs maintain metadata for each file they use
ﺗﺤﺘﻔﻆ ﺟﻤﯿﻊ اﻟﺒﺮاﻣﺞ ﺑﺒﯿﺎﻧﺎت وﺻﻔﯿﺔ ﻟﻜﻞ ﻣﻠﻒ ﺗﺴﺘﺨﺪﻣﮫ
n Duplication of Data ازدواﺟﯿﺔ اﻟﺒﯿﺎﻧﺎت
n Different systems/programs have separate copies of the same data
اﻟﺒﺮاﻣﺞ اﻟﻤﺨﺘﻠﻔﺔ ﻟﮭﺎ ﻧﺴﺦ ﻣﻨﻔﺼﻠﺔ ﻣﻦ ﻧﻔﺲ اﻟﺒﯿﺎﻧﺎت/ اﻷﻧﻈﻤﺔ
n Limited Data Sharing ﻣﺸﺎرﻛﺔ ﻣﺤﺪودة ﻟﻠﺒﯿﺎﻧﺎت
n No centralized control of data ﻻ ﯾﻮﺟﺪ ﺗﺤﻜﻢ ﻣﺮﻛﺰي ﻓﻲ اﻟﺒﯿﺎﻧﺎت
n Lengthy Development Times أوﻗﺎت اﻟﺘﻄﻮﯾﺮ اﻟﻤﻄﻮﻟﺔ
n Programmers must design their own file formats
ﯾﺠﺐ ﻋﻠﻰ اﻟﻤﺒﺮﻣﺠﯿﻦ ﺗﺼﻤﯿﻢ ﺗﻨﺴﯿﻘﺎت اﻟﻤﻠﻔﺎت اﻟﺨﺎﺻﺔ ﺑﮭﻢ
n Excessive Program Maintenance ﺻﯿﺎﻧﺔ اﻟﺒﺮﻧﺎﻣﺞ اﻟﻤﻔﺮطﺔ
n 80% of information systems budget 80٪ ﻣﻦ ﻣﯿﺰاﻧﯿﺔ ﻧﻈﻢ اﻟﻤﻌﻠﻮﻣﺎت
Figure 1-3 Old file processing systems at Pine Valley Furniture Company
Pine Valley Furniture أﻧﻈﻤﺔ ﻣﻌﺎﻟﺠﺔ اﻟﻤﻠﻔﺎت اﻟﻘﺪﯾﻤﺔ ﻓﻲ ﺷﺮﻛﺔ3-1 ﺷﻜﻞ
SOLUTION >>> The DATABASE Approach اﻟﺤﻞ <<< ﻧﮭﺞ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت
n Central repository of shared data اﻟﻤﺴﺘﻮدع اﻟﻤﺮﻛﺰي ﻟﻠﺒﯿﺎﻧﺎت اﻟﻤﺸﺘﺮﻛﺔ
n Data is managed by a controlling agent ﺗﺘﻢ إدارة اﻟﺒﯿﺎﻧﺎت ﺑﻮاﺳﻄﺔ ﻋﺎﻣﻞ ﺗﺤﻜﻢ
n Stored in a standardized, convenient form ﻣﺨﺰﻧﺔ ﻓﻲ ﺷﻜﻞ ﻣﻮﺣﺪ وﻣﺮﯾﺢ
This approach requires a Database Management System (DBMS)
(DBMS)ﯾﺘﻄﻠﺐ ھﺬا اﻟﻨﮭﺞ ﻧﻈﺎم إدارة ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت
DBMS manages data resources like an operating system manages hardware resources
ﻣﻮارد اﻟﺒﯿﺎﻧﺎت ﻣﺜﻞ ﻧﻈﺎم اﻟﺘﺸﻐﯿﻞ اﻟﺬي ﯾﺪﯾﺮ ﻣﻮارد اﻷﺟﮭﺰةDBMS ﯾﺪﯾﺮ
Costs and Risks of the Database Approach ﺗﻜﺎﻟﯿﻒ وﻣﺨﺎطﺮ ﻧﮭﺞ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت
n New, specialized personnel ﻣﻮظﻔﯿﻦ ﻣﺘﺨﺼﺼﯿﻦ ﺟﺪد
n Installation and management cost and complexity ﺗﻜﻠﻔﺔ اﻟﺘﺜﺒﯿﺖ واﻹدارة واﻟﺘﻌﻘﯿﺪ
n Conversion costs ﺗﻜﺎﻟﯿﻒ اﻟﺘﺤﻮﯾﻞ
n Need for explicit backup and recovery اﻟﺤﺎﺟﺔ إﻟﻰ ﻧﺴﺦ اﺣﺘﯿﺎطﻲ واﺳﺘﺮداد ﺻﺮﯾﺢ
n Organizational conflict اﻟﺼﺮاع اﻟﺘﻨﻈﯿﻤﻲ
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
ﯾﺰﯾﻞ اﻟﺒﯿﺎﻧﺎت اﻟﻤﺘﻜﺮرة ﻟﻠﺤﺪ ﻣﻦ اﺣﺘﻤﺎل وﺟﻮد ﺑﯿﺎﻧﺎت ﻏﯿﺮ ﻣﺘﺴﻘﺔ
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
Chapter 2
Creating Database Tables إﻧﺸﺎء ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت
Objectives
q Use structured query language (SQL) commands to create, modify, and drop database
tables
q Explain Oracle 10g user schemas
q Define Oracle 10g database tables
q Create database tables using SQL*Plus
q View information about your database tables using Oracle 10g data dictionary views
Introduction to SQL
q Structured query language (SQL)
– Standard query language for relational databases
– Consists of about 30 commands
– Enables users to create database objects and manipulate and view data
– SQL-99, SQL-2003, and SQL-2008
• Most recent versions
• Most vendors do not fully comply with SQL-2008 (but comply with
SQL-92, SQL-99)
– Basic categories for SQL commands
• Data definition language (DDL)
• Data manipulation language (DML)
Personal DBMS
q With personal DBMS …
– You are usually the only user
– You start the database application
– You create a new database
– The DBMS saves the database file in your workstation’s file system
– You create database objects (tables, etc.)
q Examples:
– MS Access
– Oracle Personal edition. But this DBMS derives most of its features from the
Oracle C/S version
Constraints
q Table constraint
– Restricts data value with respect to all other values in table like primary key
must be unique, not NULL.
q Column constraint
– Limits value that can be placed in specific column
– Irrespective of values that exist in other table rows
q Types of constraints:
– Integrity constraints
– Value constraints
q Constraint naming convention
– tablename_columnname_constraintid
q Constraint definitions should be placed either:
– At end of CREATE TABLE command after table columns declared
– Within each column definition CREATE TABLE location
q Example: (loc_id NUMBER(6)
CREATE TABLE location CONSTRAINT location_loc_id_pk PRIMARY KEY),
(loc_id NUMBER(6), Room VARCHAR2(6);
Room VARCHAR2(6),
CONSTRAINT location_loc_id_pk PRIMARY KEY (loc_id);
Value Constraints
q Value constraints
– Column-level constraints
– Restrict data values that users can enter
– Commonly used value constraints
• CHECK conditions ● NOT NULL constraint
• DEFAULT constraint ● UNIQUE constraint
CONSTRAINT student_s_class_cc
CHECK ((s_class = ‘FR’) OR (s_class = ‘SO’) OR (s_class =
‘JR’) OR (s_class = ‘SR’))
CONSTRAINT course_credits_cc
CHECK ((credits > 0) AND (credits < 12))
S_last VARCHAR2(30)
CONSTRAINT student_s_last_nn NOT NULL