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

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
‫اﻟﺒﯿﺎﻧﺎت اﻟﺘﻲ ﺗﺼﻒ ﺧﺼﺎﺋﺺ وﺳﯿﺎق ﺑﯿﺎﻧﺎت اﻟﻤﺴﺘﺨﺪم‬

Graphical displays turn data into useful


Context helps users understand data information that managers can use for:
decision making and interpretation

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 ‫ﺷﻜﻞ‬

Problems with Data Dependency ‫ﻣﺸﺎﻛﻞ اﻻﻋﺘﻤﺎد ﻋﻠﻰ اﻟﺒﯿﺎﻧﺎت‬


n Each application programmer must maintain his/her own data
‫ ﺑﯿﺎﻧﺎﺗﮭﺎ‬/ ‫ﯾﺠﺐ ﻋﻠﻰ ﻛﻞ ﻣﺒﺮﻣﺞ ﺗﻄﺒﯿﻖ اﻟﺤﻔﺎظ ﻋﻠﻰ ﺑﯿﺎﻧﺎﺗﮫ‬
n Each application program needs to include code for the metadata of each file
‫ﯾﺤﺘﺎج ﻛﻞ ﺑﺮﻧﺎﻣﺞ ﺗﻄﺒﯿﻖ إﻟﻰ ﺗﻀﻤﯿﻦ رﻣﺰ ﻟﻠﺒﯿﺎﻧﺎت اﻟﻮﺻﻔﯿﺔ ﻟﻜﻞ ﻣﻠﻒ‬
n Each application program must have its own processing routines for reading,
inserting, updating, and deleting data
‫ﯾﺠﺐ أن ﯾﻜﻮن ﻟﻜﻞ ﺑﺮﻧﺎﻣﺞ ﺗﻄﺒﯿﻖ إﺟﺮاءات ﻣﻌﺎﻟﺠﺔ ﺧﺎﺻﺔ ﺑﮫ ﻟﻘﺮاءة اﻟﺒﯿﺎﻧﺎت وإدراﺟﮭﺎ وﺗﺤﺪﯾﺜﮭﺎ وﺣﺬﻓﮭﺎ‬
n Lack of coordination and central control ‫ﻋﺪم اﻟﺘﻨﺴﯿﻖ واﻟﺮﻗﺎﺑﺔ اﻟﻤﺮﻛﺰﯾﺔ‬
n Non-standard file formats ‫ﺗﻨﺴﯿﻘﺎت اﻟﻤﻠﻔﺎت ﻏﯿﺮ اﻟﻘﯿﺎﺳﯿﺔ‬
n Waste of space to have duplicate data ‫ھﺪر ﻣﺴﺎﺣﺔ ﻟﻠﺤﺼﻮل ﻋﻠﻰ ﺑﯿﺎﻧﺎت ﻣﻜﺮرة‬
n Causes more maintenance headaches ‫ﯾﺴﺒﺐ اﻟﻤﺰﯾﺪ ﻣﻦ اﻟﺼﺪاع اﻟﺼﯿﺎﻧﺔ‬
n The biggest problem: ‫اﻟﻤﺸﻜﻠﺔ اﻷﻛﺒﺮ‬
n Data changes in one file could cause inconsistencies
‫ﻗﺪ ﺗﺆدي ﺗﻐﯿﯿﺮات اﻟﺒﯿﺎﻧﺎت ﻓﻲ ﻣﻠﻒ واﺣﺪ إﻟﻰ ﻋﺪم ﺗﻨﺎﺳﻖ‬
n Compromises in data integrity ‫ﺣﻠﻮل وﺳﻂ ﻓﻲ ﺳﻼﻣﺔ اﻟﺒﯿﺎﻧﺎت‬

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)‫ﯾﺘﻄﻠﺐ ھﺬا اﻟﻨﮭﺞ ﻧﻈﺎم إدارة ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت‬

Database Management System (DBMS) ‫ﻧﻈﺎم إدارة ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت‬


A software system that is used to create, maintain, and provide controlled access to user
databases ‫ﻧﻈﺎم ﺑﺮﻣﺠﻲ ﯾُﺴﺘﺨﺪم ﻹﻧﺸﺎء وﺻﯿﺎﻧﺔ وﺗﻮﻓﯿﺮ وﺻﻮل ﻣﺘﺤﻜﻢ ﺑﮫ إﻟﻰ ﻗﻮاﻋﺪ ﺑﯿﺎﻧﺎت اﻟﻤﺴﺘﺨﺪم‬

DBMS manages data resources like an operating system manages hardware resources
‫ ﻣﻮارد اﻟﺒﯿﺎﻧﺎت ﻣﺜﻞ ﻧﻈﺎم اﻟﺘﺸﻐﯿﻞ اﻟﺬي ﯾﺪﯾﺮ ﻣﻮارد اﻷﺟﮭﺰة‬DBMS ‫ﯾﺪﯾﺮ‬

Advantages of the Database Approach ‫ﻣﺰاﯾﺎ ﻧﮭﺞ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت‬


n Program-data independence ‫اﺳﺘﻘﻼﻟﯿﺔ ﺑﯿﺎﻧﺎت اﻟﺒﺮﻧﺎﻣﺞ‬
n Planned data redundancy ‫ﺗﻜﺮار اﻟﺒﯿﺎﻧﺎت اﻟﻤﺨﻄﻂ ﻟﮭﺎ‬
n Improved data consistency ‫اﺗﺴﺎق اﻟﺒﯿﺎﻧﺎت اﻟﻤﺤﺴﻦ‬
n Improved data sharing ‫ﺗﺤﺴﯿﻦ ﻣﺸﺎرﻛﺔ اﻟﺒﯿﺎﻧﺎت‬
n Increased application development productivity ‫زﯾﺎدة إﻧﺘﺎﺟﯿﺔ ﺗﻄﻮﯾﺮ اﻟﺘﻄﺒﯿﻘﺎت‬
n Enforcement of standards ‫إﻧﻔﺎذ اﻟﻤﻌﺎﯾﯿﺮ‬
n Improved data quality ‫ﺗﺤﺴﯿﻦ ﺟﻮدة اﻟﺒﯿﺎﻧﺎت‬
n Improved data accessibility and responsiveness ‫ﺗﺤﺴﯿﻦ إﻣﻜﺎﻧﯿﺔ اﻟﻮﺻﻮل ﻟﻠﺒﯿﺎﻧﺎت واﻻﺳﺘﺠﺎﺑﺔ ﻟﮭﺎ‬
n Reduced program maintenance ‫ﺗﻘﻠﯿﻞ ﺻﯿﺎﻧﺔ اﻟﺒﺮﻧﺎﻣﺞ‬
n Improved decision support ‫ﺗﺤﺴﯿﻦ دﻋﻢ اﻟﻘﺮار‬

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 ‫اﻟﺼﺮاع اﻟﺘﻨﻈﯿﻤﻲ‬

Elements of the Database Approach ‫ﻋﻨﺎﺻﺮ ﻧﮭﺞ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت‬


n Data models ‫ﻧﻤﺎذج اﻟﺒﯿﺎﻧﺎت‬
§ Graphical system capturing nature and relationship of data
‫ﻧﻈﺎم رﺳﻮﻣﻲ ﯾﻠﺘﻘﻂ طﺒﯿﻌﺔ وﻋﻼﻗﺔ اﻟﺒﯿﺎﻧﺎت‬
§ Enterprise Data Model–high-level entities and relationships for the
organization ‫ اﻟﻜﯿﺎﻧﺎت واﻟﻌﻼﻗﺎت ﻋﺎﻟﯿﺔ اﻟﻤﺴﺘﻮى ﻟﻠﻤﺆﺳﺴﺔ‬- ‫ﻧﻤﻮذج ﺑﯿﺎﻧﺎت اﻟﻤﺆﺳﺴﺔ‬
§ Project Data Model–more detailed view, matching data structure in database
or data warehouse ‫ ﻣﻄﺎﺑﻘﺔ ﺑﻨﯿﺔ اﻟﺒﯿﺎﻧﺎت ﻓﻲ‬، ً‫ ﻋﺮض أﻛﺜﺮ ﺗﻔﺼﯿﻼ‬- ‫ﻧﻤﻮذج ﺑﯿﺎﻧﺎت اﻟﻤﺸﺮوع‬
‫ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت أو ﻣﺴﺘﻮدع اﻟﺒﯿﺎﻧﺎت‬
n Relational Databases ‫ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت اﻟﻌﻼﺋﻘﯿﺔ‬
§Database technology involving tables (relations) representing entities and
primary/foreign keys representing relationships ‫ﺗﻘﻨﯿﺔ ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت اﻟﺘﻲ ﺗﺘﻀﻤﻦ‬
‫ اﻟﺨﺎرﺟﯿﺔ اﻟﺘﻲ ﺗﻤﺜﻞ اﻟﻌﻼﻗﺎت‬/ ‫ﺟﺪاول )ﻋﻼﻗﺎت( ﺗﻤﺜﻞ اﻟﻜﯿﺎﻧﺎت واﻟﻤﻔﺎﺗﯿﺢ اﻷﺳﺎﺳﯿﺔ‬
n Use of Internet Technology ‫اﺳﺘﺨﺪام ﺗﻘﻨﯿﺔ اﻹﻧﺘﺮﻧﺖ‬
§ Networks and telecommunications, distributed databases, client-server, and 3-
tier architectures ‫اﻟﺸﺒﻜﺎت واﻻﺗﺼﺎﻻت اﻟﺴﻠﻜﯿﺔ واﻟﻼﺳﻠﻜﯿﺔ وﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت اﻟﻤﻮزﻋﺔ وﺧﺎدم‬
‫اﻟﻌﻤﯿﻞ واﻟﺒﻨﻰ ﺛﻼﺛﯿﺔ اﻟﻤﺴﺘﻮﯾﺎت‬
n Database Applications ‫ﺗﻄﺒﯿﻘﺎت ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت‬
§ Application programs used to perform database activities (create, read, update,
and delete) for database users ‫ﺑﺮاﻣﺞ اﻟﺘﻄﺒﯿﻘﺎت اﻟﻤﺴﺘﺨﺪﻣﺔ ﻷداء أﻧﺸﻄﺔ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت )إﻧﺸﺎء‬
‫وﻗﺮاءة وﺗﺤﺪﯾﺚ وﺣﺬف( ﻟﻤﺴﺘﺨﺪﻣﻲ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت‬
Components of the Database Environment ‫ﻣﻜﻮﻧﺎت ﺑﯿﺌﺔ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت‬
n CASE Tools–computer-aided software engineering
.‫وﺗﻘﻮم ﻋﻠﻰ ھﻨﺪﺳﺔ اﻟﺒﺮﻣﺠﯿﺎت ﺑﺎﺳﺘﺨﺪام اﻟﺤﺎﺳﻮب ﻋﻠﻰ ﺗﺼﻤﯿﻢ اﻟﺘﻄﺒﯿﻘﺎت وﺗﻨﻔﯿﺬھﺎ‬
n Repository–centralized storehouse of metadata
.‫ﻣﺨﺰن ﻣﺮﻛﺰي ﻟﻠﺒﯿﺎﻧﺎت اﻟﻮﺻﻔﯿﺔ واﻟﺘﻲ ﺗﻘﻮم ﺑﺘﺰوﯾﺪﻧﺎ ﺑﻤﻌﻠﻮﻣﺎت ﻋﻦ ﺑﯿﺎﻧﺎت أﺧﺮى‬
n Database Management System (DBMS) –software for managing the database
‫ﺑﺮﻧﺎﻣﺞ ﻹدارة ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت‬
n Database–storehouse of the data
‫ﻣﺨﺰن اﻟﺒﯿﺎﻧﺎت‬
n Application Programs–software using the data
.(‫اﻟﺒﺮاﻣﺞ اﻟﺘﻲ ﺗﺴﺘﺨﺪم اﻟﺒﯿﺎﻧﺎت )إﺟﺮاء اﻟﻌﻤﻠﯿﺎت‬
n User Interface–text and graphical displays to users
.(‫ﻋﺮوض ﻧﺼﯿﺔ ورﺳﻮﻣﯿﺔ ﻟﻠﻤﺴﺘﺨﺪﻣﯿﻦ )واﺟﮭﺔ اﻟﻤﺴﺘﺨﺪم‬
n Data/Database Administrators–personnel responsible for maintaining the database
‫اﻟﻤﻮظﻔﻮن اﻟﻤﺴﺆوﻟﻮن ﻋﻦ ﺻﯿﺎﻧﺔ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت‬
n System Developers–personnel responsible for designing databases and software
‫اﻟﻤﻮظﻔﻮن اﻟﻤﺴﺆوﻟﻮن ﻋﻦ ﺗﺼﻤﯿﻢ ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت واﻟﺒﺮاﻣﺞ‬
n End Users–people who use the applications and databases
‫اﻷﺷﺨﺎص اﻟﺬﯾﻦ ﯾﺴﺘﺨﺪﻣﻮن اﻟﺘﻄﺒﯿﻘﺎت وﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت‬

The Range of Database Applications ‫ﻧﻄﺎق ﺗﻄﺒﯿﻘﺎت ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت‬


n Personal databases ‫ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت اﻟﺸﺨﺼﯿﺔ‬
n Workgroup databases ‫ﻗﻮاﻋﺪ ﺑﯿﺎﻧﺎت ﻣﺠﻤﻮﻋﺔ اﻟﻌﻤﻞ‬
n Departmental/divisional databases ‫ اﻷﻗﺴﺎم‬/ ‫ﻗﻮاﻋﺪ ﺑﯿﺎﻧﺎت اﻹدارات‬
n Enterprise database ‫ﻗﺎﻋﺪة ﺑﯿﺎﻧﺎت اﻟﻤﺆﺳﺴﺔ‬
Figure 1-7 Workgroup database with
wireless local area network

Figure 1-6: Typical data from a personal database

Enterprise Database Applications


‫ﺗﻄﺒﯿﻘﺎت ﻗﺎﻋﺪة ﺑﯿﺎﻧﺎت اﻟﻤﺆﺳﺴﺔ‬

n Enterprise Resource Planning (ERP)


‫ﺗﺨﻄﯿﻂ ﻣﻮارد اﻟﻤﺆﺳﺴﺎت‬
§ Integrate all enterprise functions (manufacturing, finance, sales, marketing,
inventory, accounting, human resources)
(‫ اﻟﻤﻮارد اﻟﺒﺸﺮﯾﺔ‬،‫ اﻟﻤﺤﺎﺳﺒﺔ‬،‫ اﻟﻤﺨﺰون‬،‫ اﻟﺘﺴﻮﯾﻖ‬،‫ اﻟﻤﺒﯿﻌﺎت‬،‫ اﻟﺘﻤﻮﯾﻞ‬،‫دﻣﺞ ﺟﻤﯿﻊ وظﺎﺋﻒ اﻟﻤﺆﺳﺴﺔ )اﻟﺘﺼﻨﯿﻊ‬
n Data Warehouse ‫ﻣﺴﺘﻮدع اﻟﺒﯿﺎﻧﺎت‬
§ Integrated decision support system derived from various operational databases
‫ﻧﻈﺎم دﻋﻢ اﻟﻘﺮار اﻟﻤﺘﻜﺎﻣﻞ اﻟﻤﺴﺘﻤﺪ ﻣﻦ ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت اﻟﺘﺸﻐﯿﻠﯿﺔ اﻟﻤﺨﺘﻠﻔﺔ‬

Figure 1-8: An enterprise data warehouse Evolution of DB Systems


Chapter 1:
Client/Server Databases and the Oracle 10g Relational Database
10 ‫ اﻟﺨﺎدم وﻗﺎﻋﺪة ﺑﯿﺎﻧﺎت أوراﻛﻞ‬/ ‫ﻗﻮاﻋﺪ ﺑﯿﺎﻧﺎت اﻟﻌﻤﯿﻞ‬g

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 ‫ﺣﺬف ﻗﯿﻢ اﻟﺒﯿﺎﻧﺎت‬

• Database Administrator ‫ﻣﺴﺆول ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت‬


– Person responsible for installing, administering, and maintaining the database
‫اﻟﺸﺨﺺ اﻟﻤﺴﺆول ﻋﻦ ﺗﺜﺒﯿﺖ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت وإدارﺗﮭﺎ وﺻﯿﺎﻧﺘﮭﺎ‬
– Often called DBA
‫ﻏﺎﻟﺒﺎ ﻣﺎ ﯾﺴﻤﻰ ﻣﺴﺆول ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت‬DBA

Database Approach to Data Processing


‫ﻧﮭﺞ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت ﻟﻤﻌﺎﻟﺠﺔ اﻟﺒﯿﺎﻧﺎت‬

Overview of Relational Databases


‫ﻧﻈﺮة ﻋﺎﻣﺔ ﻋﻠﻰ ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت اﻟﻌﻼﺋﻘﯿﺔ‬
• Table ‫ﺟﺪول‬
– Matrix with columns and rows‫ﻣﺼﻔﻮﻓﺔ ﻣﻊ اﻷﻋﻤﺪة واﻟﺼﻔﻮف‬
• Columns ‫اﻻﻋﻤﺪة‬
– Represent different data fields
‫ﺗﻤﺜﻞ ﺣﻘﻮل اﻟﺒﯿﺎﻧﺎت اﻟﻤﺨﺘﻠﻔﺔ‬
– Characteristics or attributes about entity
‫ﺧﺼﺎﺋﺺ أو ﺳﻤﺎت ﺣﻮل اﻟﻜﯿﺎن‬
• Rows ‫اﻟﺼﻔﻮف‬
– Contain individual records ‫ﺗﺤﺘﻮي ﻋﻠﻰ ﺳﺠﻼت ﻓﺮدﯾﺔ‬
– Attributes about a specific instance of entity
‫ﺳﻤﺎت ﺣﻮل ﻧﺴﺨﺔ ﻣﺤﺪدة أو )ﻣﺜﯿﻞ ﻣﻌﯿﻦ( ﻣﻦ اﻟﻜﯿﺎن‬
• Entity ‫ﻛﯿﺎن‬
– Object about which you want to store data
‫ھﻮ ﻛﺎﺋﻦ ﻧﺮﯾﺪ ﺗﺨﺰﯾﻦ اﻟﺒﯿﺎﻧﺎت ﻋﻨﮫ‬
– Different tables store data about each different entity ‫اﻟﺠﺪاول اﻟﻤﺨﺘﻠﻔﺔ ﺗﺨﺰن اﻟﺒﯿﺎﻧﺎت‬
‫ﻋﻦ ﻛﻞ ﻛﯿﺎن ﻣﺨﺘﻠﻒ‬
• Relationships ‫اﻟﻌﻼﻗﺎت‬
– Links that show how different records are related
‫اﻟﺮواﺑﻂ اﻟﺘﻲ ﺗﺒﯿﻦ ﻣﺪى ارﺗﺒﺎط اﻟﺴﺠﻼت اﻟﻤﺨﺘﻠﻔﺔ‬
• Key fields ‫اﻟﺤﻘﻮل اﻟﺮﺋﯿﺴﯿﺔ‬
– Establish relationships among records in different tables ‫ﺗﺄﺳﯿﺲ ﻋﻼﻗﺎت ﺑﯿﻦ‬
‫اﻟﺴﺠﻼت ﻓﻲ ﺟﺪاول ﻣﺨﺘﻠﻔﺔ‬
– Main types of key fields:
‫اﻷﻧﻮاع اﻟﺮﺋﯿﺴﯿﺔ ﻣﻦ اﻟﺤﻘﻮل اﻟﺮﺋﯿﺴﯿﺔ‬
• Primary ‫اﻷﺳﺎﺳﻲ‬
• Candidate ‫ﻣﺮﺷﺢ‬
• Surrogate ‫ﺑﺪﯾﻞ‬
• Foreign ‫أﺟﻨﺒﻲ‬
• Composite ‫ﻣﺮﻛﺐ‬

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
‫ﯾﺠﺐ أن ﺗﻜﻮن اﻟﻘﯿﻤﺔ ﻣﻮﺟﻮدة ﻓﻲ اﻟﺠﺪول ﺣﯿﺚ ﯾﻜﻮن اﻟﻤﻔﺘﺎح اﻷﺳﺎﺳﻲ‬

Composite Keys ‫اﻟﻤﻔﺎﺗﯿﺢ اﻟﻤﺮﻛﺒﺔ‬


• Unique key that is created by combining two or more columns
‫اﻟﻤﻔﺘﺎح اﻟﻔﺮﯾﺪ اﻟﺬي ﺗﻢ إﻧﺸﺎؤه ﻋﻦ طﺮﯾﻖ اﻟﺠﻤﻊ ﺑﯿﻦ ﻋﻤﻮدﯾﻦ أو أﻛﺜﺮ‬
• Usually comprises fields that are primary keys in other tables
‫ﯾﺸﺘﻤﻞ ﻋﺎدة ً ﻋﻠﻰ اﻟﺤﻘﻮل اﻟﺘﻲ ﺗﻤﺜﻞ اﻟﻤﻔﺎﺗﯿﺢ اﻷﺳﺎﺳﯿﺔ ﻓﻲ اﻟﺠﺪاول اﻷﺧﺮى‬

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
‫اﻟﺒﺮﻧﺎﻣﺞ اﻟﺬي ﯾﻄﻠﺐ وﯾﺴﺘﺨﺪم ﻣﻮارد اﻟﺨﺎدم‬

Personal Database Management Systems


‫ﻧﻈﻢ إدارة ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت اﻟﺸﺨﺼﯿﺔ‬
• DBMS and database applications run on same workstation
‫ﺗﻌﻤﻞ ﺗﻄﺒﯿﻘﺎت ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت وﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت ﻋﻠﻰ ﻧﻔﺲ ﻣﺤﻄﺔ اﻟﻌﻤﻞ‬
• Appear to user as a single integrated application
‫ﺗﻈﮭﺮ ﻟﻠﻤﺴﺘﺨﺪم ﻛﺘﻄﺒﯿﻖ ﻣﺘﻜﺎﻣﻞ واﺣﺪ‬
• Used primarily for creating single-user database applications ‫ﯾﺴﺘﺨﺪم ﺑﺸﻜﻞ أﺳﺎﺳﻲ ﻹﻧﺸﺎء‬
‫ﺗﻄﺒﯿﻘﺎت ﻗﺎﻋﺪة ﺑﯿﺎﻧﺎت اﻟﻤﺴﺘﺨﺪم اﻟﻔﺮدي‬
• Can also be used for some multiuser applications
‫ﯾﻤﻜﻦ أن ﺗﺴﺘﺨﺪم أﯾﻀﺎ ﻟﺒﻌﺾ اﻟﺘﻄﺒﯿﻘﺎت ﻣﺘﻌﺪدة اﻟﻤﺴﺘﺨﺪﻣﯿﻦ‬
• Should be used only for applications that are not mission critical
‫ﯾﺠﺐ أن ﺗﺴﺘﺨﺪم ﻓﻘﻂ ﻟﻠﺘﻄﺒﯿﻘﺎت اﻟﺘﻲ ﻟﯿﺴﺖ ﻣﮭﻤﺔ ﺣﺮﺟﺔ‬
• Microsoft Access ‫ﻣﺪﺧﻞ اﻟﺒﺮﻣﺠﯿﺎت اﻟﻤﺮﻧﺔ‬
– Stores all data for database in a single file with an .mdb extension
. ‫ﯾﺨﺰن ﺟﻤﯿﻊ اﻟﺒﯿﺎﻧﺎت ﻟﻘﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت ﻓﻲ ﻣﻠﻒ واﺣﺪ ﺑﻤﻠﺤﻖ‬mdb
– Database administrator stores .mdb file on a central file server
. ‫ﻣﺴﺆول ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت ﺑﺘﺨﺰﯾﻦ ﻣﻠﻒ‬mdb ‫ﻋﻠﻰ ﺧﺎدم ﻣﻠﻔﺎت ﻣﺮﻛﺰي‬
• Transaction processing ‫ﻣﻌﺎﻟﺠﺔ اﻟﻤﻌﺎﻣﻼت‬
– Grouping related database changes into units of work that must either all
succeed or all fail
‫ﺗﺠﻤﯿﻊ ﺗﻐﯿﯿﺮات ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت ذات اﻟﺼﻠﺔ ﻓﻲ وﺣﺪات اﻟﻌﻤﻞ اﻟﺘﻲ ﯾﺠﺐ أن ﺗﻨﺠﺢ ﺟﻤﯿﻌﮭﺎ أو ﺗﻔﺸﻞ ﺟﻤﯿﻌﮭﺎ‬
– DBMS can use the transaction log to reverse—or roll back—the changes
‫ﯾﻤﻜﻦ ﻟـ‬DBMS ‫ أو اﻟﺘﺮاﺟﻊ ﻋﻨﮭﺎ‬- ‫اﺳﺘﺨﺪام ﺳﺠﻞ اﻟﻤﻌﺎﻣﻼت ﻟﻌﻜﺲ اﻟﺘﻐﯿﯿﺮات‬
Using a Personal Database for a Multiuser Application
‫اﺳﺘﺨﺪام ﻗﺎﻋﺪة ﺑﯿﺎﻧﺎت ﺷﺨﺼﯿﺔ ﻟﺘﻄﺒﯿﻖ ﻣﺘﻌﺪد اﻟﻤﺴﺘﺨﺪﻣﯿﻦ‬

Client/Server Database Management Systems


‫ اﻟﺨﺎدم‬/ ‫أﻧﻈﻤﺔ إدارة ﻗﻮاﻋﺪ ﺑﯿﺎﻧﺎت اﻟﻌﻤﯿﻞ‬
• DBMS server process runs on one workstation
‫ﺗﻌﻤﻞ ﻋﻤﻠﯿﺔ ﺧﺎدم‬DBMS ‫ﻋﻠﻰ ﻣﺤﻄﺔ ﻋﻤﻞ واﺣﺪة‬
• Database applications run on separate client workstations across network
‫ﺗﻌﻤﻞ ﺗﻄﺒﯿﻘﺎت ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت ﻋﻠﻰ ﻣﺤﻄﺎت ﻋﻤﻞ اﻟﻌﻤﯿﻞ اﻟﻤﻨﻔﺼﻠﺔ ﻋﺒﺮ اﻟﺸﺒﻜﺔ‬
• Server sends only requested data back to client rather than entire database
‫ﯾﺮﺳﻞ اﻟﺨﺎدم اﻟﺒﯿﺎﻧﺎت اﻟﻤﻄﻠﻮﺑﺔ ﻣﺮة أﺧﺮى إﻟﻰ اﻟﻌﻤﯿﻞ ﺑﺪﻻً ﻣﻦ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت ﺑﺄﻛﻤﻠﮭﺎ‬
• Generate less network traffic than personal databases
‫ﺗﻮﻟﯿﺪ ﺣﺮﻛﺔ ﻣﺮور ﺷﺒﻜﺔ أﻗﻞ ﻣﻦ ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت اﻟﺸﺨﺼﯿﺔ‬
• Extra features to minimize chance of failure
‫ﻣﯿﺰات إﺿﺎﻓﯿﺔ ﻟﺘﻘﻠﯿﻞ ﻓﺮﺻﺔ اﻟﻔﺸﻞ‬
• Powerful recovery mechanisms that often operate automatically
‫آﻟﯿﺎت اﻻﺳﺘﺮداد ﻗﻮﯾﺔ اﻟﺘﻲ ﺗﻌﻤﻞ ﻓﻲ ﻛﺜﯿﺮ ﻣﻦ اﻷﺣﯿﺎن ﺗﻠﻘﺎﺋﯿﺎ‬
• Maintain file-based transaction log on database server
‫اﻻﺣﺘﻔﺎظ ﺑﺴﺠﻞ اﻟﻤﻌﺎﻣﻠﺔ اﻟﻤﺴﺘﻨﺪ إﻟﻰ اﻟﻤﻠﻔﺎت ﻋﻠﻰ ﺧﺎدم ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت‬
• Preferred for ‫ﻣﻔﻀﻞ ل‬
– Database applications that retrieve and manipulate small amounts of data from
databases containing large numbers of records
‫ﺗﻄﺒﯿﻘﺎت ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت اﻟﺘﻲ ﺗﻘﻮم ﺑﺎﺳﺘﺮداد وﻣﻌﺎﻟﺠﺔ ﻛﻤﯿﺎت ﺻﻐﯿﺮة ﻣﻦ اﻟﺒﯿﺎﻧﺎت ﻣﻦ ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت اﻟﺘﻲ ﺗﺤﺘﻮي ﻋﻠﻰ أﻋﺪاد‬
‫ﻛﺒﯿﺮة ﻣﻦ اﻟﺴﺠﻼت‬
– Mission-critical applications ‫ﺗﻄﺒﯿﻘﺎت ﻣﮭﻤﺔ ﺣﺮﺟﺔ‬
– Web-based database applications that require increased security and fault
tolerance
‫ﺗﻄﺒﯿﻘﺎت ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت اﻟﻤﺴﺘﻨﺪة إﻟﻰ اﻟﻮﯾﺐ واﻟﺘﻲ ﺗﺘﻄﻠﺐ زﯾﺎدة اﻷﻣﺎن واﻟﺘﺴﺎﻣﺢ ﻣﻊ اﻟﺨﻄﺄ‬

Client/Server Database Architecture


‫ اﻟﺨﺎدم‬/ ‫اﻟﺒﻨﯿﺔ اﻟﮭﯿﻜﻠﯿﺔ او اﻟﻌﻤﺎرة ﻟﻘﺎﻋﺪة ﺑﯿﺎﻧﺎت اﻟﻌﻤﯿﻞ‬
The Oracle 10g Client/Server Database
‫ ﺧﺎدم‬/ ‫ﻗﺎﻋﺪة ﺑﯿﺎﻧﺎت ﻋﻤﯿﻞ‬Oracle 10g
• Oracle 10g
– Latest release of Oracle Corporation’s relational database
‫أﺣﺪث إﺻﺪار ﻣﻦ ﻗﺎﻋﺪة اﻟﺒﯿﺎﻧﺎت اﻟﺘﺮاﺑﻄﯿﺔ ﻟﺸﺮﻛﺔ‬Oracle Corporation
– Client/server database ‫ اﻟﺨﺎدم‬/ ‫ﻗﺎﻋﺪة ﺑﯿﺎﻧﺎت اﻟﻌﻤﯿﻞ‬
• Server side ‫ﺟﺎﻧﺐ اﻟﺨﺎدم‬
– DBMS server process
‫ﯾﻀﻢ ﻋﻤﻠﯿﺔ ﺧﺎدم‬DBMS‫ادارة ﻧﻈﻢ ﻗﻮاﻋﺪ اﻟﺒﯿﺎﻧﺎت‬
• Oracle Net ‫أوراﻛﻞ ﻧﺖ‬
– Utility that enables network communication between client and server
‫اﻷداة اﻟﻤﺴﺎﻋﺪة اﻟﺘﻲ ﺗﺘﯿﺢ اﺗﺼﺎل اﻟﺸﺒﻜﺔ ﺑﯿﻦ اﻟﻌﻤﯿﻞ واﻟﺨﺎدم‬
• Oracle Application Server ‫ﺧﺎدم ﺗﻄﺒﯿﻘﺎت أوراﻛﻞ‬
– Used to create World Wide Web pages that allow users to access Oracle
databases
‫ﯾﺴﺘﺨﺪم ﻹﻧﺸﺎء ﺻﻔﺤﺎت اﻟﻮﯾﺐ اﻟﻌﺎﻟﻤﯿﺔ اﻟﺘﻲ ﺗﺘﯿﺢ ﻟﻠﻤﺴﺘﺨﺪﻣﯿﻦ اﻟﻮﺻﻮل إﻟﻰ ﻗﻮاﻋﺪ ﺑﯿﺎﻧﺎت أوراﻛﻞ‬
• Oracle client products: :‫ﻣﻨﺘﺠﺎت ﻋﻤﯿﻞ أوراﻛﻞ‬
– SQL*Plus
– Oracle 10g Developer Suite
– Enterprise Manager

Client/Server Architecture for Oracle 10g DBMS


Oracle 10g DBMS‫ ﺧﺎدم ل‬/ ‫اﻟﮭﻨﺪﺳﺔ اﻟﻤﻌﻤﺎرﯾﺔ اﻟﻌﻤﯿﻞ‬

The Database Cases


• Fictional organizations:
– Clearwater Traders
– Northwoods University
• Design principles:
– Convert all tables to third normal form
– Include primary key as foreign key in table on “many” side of relationship
– Specify data type for each column

The Clearwater Traders Sales Order Database


• Clothing and sporting goods through mail-order catalogs
• Wants to begin accepting orders using Web site
• Required data consists of information for:
– Customers
– Orders
– Items
– Shipments
• Tables:
– CUSTOMER
– ORDER_SOURCE
– ORDERS
– CATEGORY
– ITEM
• Tables (continued):
– ORDER_LINE
– SHIPMENT
– INVENTORY
– SHIPMENT_LINE
– COLOR

The Northwoods University


Student Registration Database
• Student registration system
• Data items consist of information about:
– Students
– Courses
– Instructors
– Student Enrollment
• Tables:
– LOCATION
– FACULTY
– STUDENT
– TERM
– COURSE
– COURSE_SECTION
– ENROLLMENT

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

Oracle 10g Enterprise edition


q A Client/server DBMS
q User account
– Created for each user
– Identified using unique username and password
q User schema
– Area of database belonging to user
q Database objects
– Example: tables, forms, reports, …
– Also called schema objects
– Objects created by user reside in their user schema

Defining Oracle Database Tables


q Tables
– Primary data objects in relational database
– When you create a new table, you must specify…
• Table name ● Each field (i.e. column) name
• Each field data type/size ● You may specify constraints
q Constraints
– Restrictions on data values that column can store
q Oracle naming standard
– Rules established by Oracle corp. for naming objects
– One to 30 characters long
– Contain letters, numbers, and special symbols $, _, and #
– Begin with character
– Example: S_ID, f_id, PRICE, PRICE$, Not #ITEM.

q CREATE TABLE SQL syntax


CREATE TABLE tablename
(columnname1 data_type,
columnname2 data_type, …);
q Example:
CREATE TABLE student
(s_id CHAR(5),
s_first VARCHAR2(20));
q Basic data types
• Character ● Number ● Date/time ● Large object
Character Data Types
q VARCHAR2
– Variable-length character data (up to 4000 characters)
– Syntax: columnname VARCHAR2(maximum_size)
– If user enters data value less than maximum_size, DBMS only stores actual
character values
q CHAR
– Fixed-length character data (default = 2000)
– Syntax: columnname CHAR(maximum_size)
– If user enters data value less than maximum_size, DBMS adds trailing blank
spaces to the end of entry
q Oracle stores CHAR and VARCHAR2 data using the ASCII coding
Q: s_last CHAR(20) was used to define the data type for s_last in the student table. How many characters will Oracle save to the disk if the
user enters illia as the student’s last name?
q Unicode coding
– Standardized technique that provides way to encode data in diverse languages
q NVARCHAR2
– Counterpart of VARCHAR2
– Uses Unicode coding
q NCHAR
– Counterpart of CHAR
– Uses Unicode encoding

Number Data Types


q NUMBER
– Used for all numeric data
– Syntax
• columnname NUMBER [([precision,] [scale])]
precision: # of digits both to left and right of decimal point
scale: # of digits on the right side of decimal point
q Example:
– s_balance NUMBER (5,2)
– s_gpa NUMBER (3,2)

Number Data subtypes


q Integer number syntax
– columnname NUMBER(precision)
q Fixed-point number
– Contains specific number of decimal places
– Column declaration specifies both precision and scale
– Example: price NUMBER(5,2)
q Floating-point number
– Contains variable number of decimal places
– Decimal point may appear anywhere (.005, 2.34, etc.)
– Syntax: columnname NUMBER
– Example: s_gpa NUMBER

Date And Time Data Types


q Datetime data subtypes
– Store actual date and time values
– DATE
– TIMESTAMP
q Interval data subtypes
– Store elapsed time interval between two datetime values
– INTERVAL YEAR TO MONTH
– INTERVAL DAY TO SECOND
q DATE
– Stores dates from Dec 31, 4712 BC to Dec 31, AD 4712
– Default date format: DD-MON-YY
– Default time format: HH:MI:SS AM
– Syntax: columnname DATE
q TIMESTAMP
If omitted, default is 6 decimal place

– Stores date values similar to DATE data type


– Also stores fractional seconds
– Syntax: columnname TIMESTAMP
(fractional_seconds_precision)
– Example: shipment_date TIMESTAMP(2)
q INTERVAL YEAR TO MONTH
– Stores time interval expressed in years and months using the following syntax:
+|– elapsed_years-elapsed_months
– Example: +02-11 specifies 2 years and 11 months
– Example:
time_enrolled INTERVAL YEAR TO MONTH
q INTERVAL DAY TO SECOND
– Stores time interval expressed in days, hours, minutes, and seconds using the
following syntax:
Columnname INTERVAL DAY [(leading_precision)] TO SECOND
[(fractional_seconds_precision)]
Max allowed number of digits used
Max allowed number of digits used to express the elapsed days
to express the elapsed seconds
Large Object (LOB) Data Types
q Store binary data such as:
– Digitized sounds or images
– References to binary files from word processor or spreadsheet
q General syntax
– columnname Lob_data_type

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);

CREATE TABLE location


Integrity Constraints (loc_id NUMBER(6)
CONSTRAINT location_loc_id_pk PRIMARY KEY),
q Primary key Room VARCHAR2(6));
– Syntax (within table definition)
• CONSTRAINT constraint_name PRIMARY KEY
– Syntax (at end of table definition)
• CONSTRAINT constraint_name PRIMARY KEY (columnname)
CREATE TABLE location
(loc_id NUMBER(6),
Room VARCHAR2(6),
CONSTRAINT location_loc_id_pk PRIMARY KEY (loc_id));
q Foreign key
– Column constraint
– Specifies that value user inserts in column must exist as primary key in referenced table
– Syntax (placed at end of table definition)
CONSTRAINT constraint_name
FOREIGN KEY (columnname)
REFERENCES primary_key_tablename (primary_key_columnname)
– Example of foreign key defined in the Faculty table:
CONSTRAINT faculty_loc_id_fk
FOREIGN KEY (loc_id)
REFERENCES location (loc_id)
q Foreign key (continued)
– Syntax (placed within table definition)
CONSTRAINT constraint_name
REFERENCES primary_key_tablename
(primary_key_columnname)
– Example:
loc_id NUMBER(6) CONSTRAINT faculty_loc_id_fk
REFERENCES location (loc_id)
q Composite key
– Syntax
CONSTRAINT constraint_name
PRIMARY KEY (columnname1, columnname2 …)
– Example:
CREATE TABLE enrollment
(s_id NUMBER(5) CONSTRAINT enrollment_s_id_fk REFERENCES student(s_id),
c_sec_id NUMBER(8) CONSTRAINT enrollment_c_sec_id_fk REFERENCES course_section(c_sec__id),
CONSTRAINT enrollment_s_id_c_sec_id_pk PRIMARY KEY (s_id, c_sec_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’))

s_state CHAR(2) DEFAULT ‘FL’

CONSTRAINT course_credits_cc
CHECK ((credits > 0) AND (credits < 12))

S_last VARCHAR2(30)
CONSTRAINT student_s_last_nn NOT NULL

You might also like