Introductionمقدمة

الشريحة 1 من 16

مقدمة الفصل

تفاصيل المصدرالفصل 1 · الشريحة ⁦2⁩
المصدر
الفصل 1 · الشريحة ⁦2⁩

Database Management System (DBMS)نظام إدارة قواعد البيانات

Database management systems and the drawbacks of file systems

DBMS
Contains information about a particular enterprise: a collection of interrelated data, a set of programs to access the data, and an environment that is both convenient and efficient to use.

Database applications (slide 3)

  • Banking: transactions
  • Airlines: reservations, schedules
  • Universities: registration, grades
  • Sales: customers, products, purchases
  • Online retailers: order tracking, recommendations
  • Manufacturing: production, inventory, supply chain
  • Human resources: employee records, salaries
  • University database example: add students, instructors, courses; register students and generate class rosters; assign grades, compute GPA and generate transcripts.
  • In the early days, database applications were built directly on top of file systems.
تفاصيل المصدرالفصل 1 · الشرائح ⁦3–4⁩
المصدر
الفصل 1 · الشرائح ⁦3–4⁩

Drawbacks of using file systems to store dataعيوب أنظمة الملفات

Database management systems and the drawbacks of file systems

Drawbacks of using file systems (slides 5–6)
Drawback (slides 5–6)What goes wrong
Data redundancy and inconsistencyMultiple file formats, duplication of information in different files
Difficulty in accessing dataNeed to write a new program to carry out each new task
Data isolationMultiple files and formats
Integrity problems
  • Constraints (e.g., account balance > 0) "buried" in program code
  • hard to add or change constraints
Atomicity of updatesFailures may leave the database inconsistent with partial updates
Concurrent access by multiple usersUncontrolled concurrent accesses can lead to inconsistencies
Security problemsHard to provide user access to some, but not all, data

من الشرائح

  • Atomicity: a transfer of funds from one account to another should either complete or not happen at all.
  • Concurrency: two people read a balance (say 100) and each withdraws 50 at the same time.
  • Database systems offer solutions to all the above problems.

A university keeps student phone numbers in both the registration file and the library file; after a student changes number, the two files disagree. Which drawback of file systems is this?

تفاصيل المصدرالفصل 1 · الشرائح ⁦5–6⁩
المصدر
الفصل 1 · الشرائح ⁦5–6⁩

Levels of abstractionمستويات التجريد

View of data: an architecture for a database system (slide 8)

view level

view 1view 2… view n
Physical levelالمستوى المادي
Describes how a record (e.g., instructor) is stored.
Logical levelالمستوى المنطقي
Describes data stored in database, and the relationships among the data (e.g., type instructor = record ID, name, dept_name, salary).
View levelمستوى العرض
Application programs hide details of data types; views can also hide information (such as an employee's salary) for security purposes.
  • In the figure, the view level sits on the logical level, which sits on the physical level.

Which level of abstraction can hide information such as an employee's salary for security purposes?

تفاصيل المصدرالفصل 1 · الشرائح ⁦7–8⁩
المصدر
الفصل 1 · الشرائح ⁦7–8⁩

Schemas and instancesالمخطط والنسخة

Levels of abstraction, schemas, instances and data independence

Schema
Structural design that defines how data is organized, stored, and related. The process of designing a schema is known as data modeling.
Schemas by abstraction level (slide 9)
SchemaDefines (slide 9)
Physical schemaHow data is physically stored on disk or storage devices: file structures, indices, partitioning, compression
Logical schemaWhat data is stored and the overall logical structure: tables, attributes, primary keys, foreign keys, integrity constraints — without worrying about physical storage
View schemaHighest level of abstraction: how end-users interact with the database, a view as per the user role of application
Instance
The actual content of the database at a particular point in time — analogous to the value of a variable.
تفاصيل المصدرالفصل 1 · الشرائح ⁦9–10⁩
المصدر
الفصل 1 · الشرائح ⁦9–10⁩
ملاحظات حول المصدر (1)
  • تذكر الشريحة 9 «conceptual» ثم تصف «Logical Schema»، والمقصود المستوى نفسه.

Data independenceاستقلال البيانات

Data independence
Ability to modify the database schema at one level of a database system without affecting the schema at the next higher level.

Physical data independenceالاستقلال المادي

  • Modify the physical schema without changing the logical schema
  • Applications depend on the logical schema
  • Example: switching from a Hard Disk to a Solid State Drive (SSD)

Logical data independenceالاستقلال المنطقي

  • Modify the conceptual schema without modifying view/external schema
  • Example: adding a new column (attribute) to a table or modifying an entity relationship

A company moves its database from a hard disk to an SSD, and no table definitions or applications need to change. Which property does this show?

تفاصيل المصدرالفصل 1 · الشريحة ⁦10⁩
المصدر
الفصل 1 · الشريحة ⁦10⁩

Data modelsنماذج البيانات

Data models
A collection of tools for describing data, data relationships, data semantics, data constraints.
  1. Relational modelAll the data is stored in various tables (columns and rows).
  2. Entity-Relationship data modelMainly for database design.
  3. Object-based data modelsObject-oriented and object-relational.
  4. Semistructured data modelXML.
  5. Other older modelsNetwork model; hierarchical model.

Which data model is used mainly for database design?

تفاصيل المصدرالفصل 1 · الشرائح ⁦11–13⁩
المصدر
الفصل 1 · الشرائح ⁦11–13⁩

Object-relational data models and XMLالكائني العلائقي وXML

Object-relational data models (slide 20)

  • Relational model: flat, "atomic" values.
  • Extend the relational data model by including object orientation and constructs to deal with added data types.
  • Allow attributes of tuples to have complex types, including non-atomic values such as nested relations.
  • Preserve relational foundations, in particular the declarative access to data, while extending modeling power.
  • Provide upward compatibility with existing relational languages.

XML: Extensible Markup Language (slide 21)

  • Defined by the WWW Consortium (W3C).
  • Originally intended as a document markup language, not a database language.
  • New tags and nested tag structures made XML a great way to exchange data, not just documents.
  • XML has become the basis for all new generation data interchange formats.
تفاصيل المصدرالفصل 1 · الشرائح ⁦20–21⁩
المصدر
الفصل 1 · الشرائح ⁦20–21⁩

Data Definition Language (DDL)لغة تعريف البيانات

DDL, DML and SQL

DDL
Specification notation for defining the database schema.

من الشرائح

  • create table instructor ( ID char(5), name varchar(20), dept_name varchar(20), salary numeric(8,2))
  • DDL compiler generates a set of table templates stored in a data dictionary.
  • Data dictionary contains metadata (i.e., data about data):
    • Database schema
    • Integrity constraints — primary key (ID uniquely identifies instructors)
    • Authorization — who can access what

Where does the DDL compiler store the table templates it generates, and what is that store said to contain?

تفاصيل المصدرالفصل 1 · الشريحة ⁦14⁩
المصدر
الفصل 1 · الشريحة ⁦14⁩

DML and SQLDML و SQL

DML
Language for accessing and manipulating the data organized by the appropriate data model; also known as query language.
Two classes of languages (slide 15)

Pure

  • Used for proving properties about computational power and for optimization
  • Relational Algebra
  • Tuple relational calculus
  • Domain relational calculus

Commercial

  • Used in commercial systems
  • SQL is the most widely used commercial language
  • SQL is NOT a Turing machine equivalent language; to compute complex functions SQL is usually embedded in some higher-level language.
  • Application programs access databases through language extensions to allow embedded SQL or an application program interface (e.g., ODBC/JDBC).

Which statement about query languages is correct?

تفاصيل المصدرالفصل 1 · الشرائح ⁦15–16⁩
المصدر
الفصل 1 · الشرائح ⁦15–16⁩

Database designتصميم قاعدة البيانات

Logical designالتصميم المنطقي

  • Deciding on the database schema
  • Find a "good" collection of relation schemas
  • Business decision: what attributes should we record?
  • Computer Science decision: what relation schemas, and how are attributes distributed among them?

Physical designالتصميم المادي

  • Deciding on the physical layout of the database
  1. Slide 18

    One relation holds ID, name, salary, dept_name, building, budget for every instructor. "Is there any problem with this relation?"

Design approaches (slide 19)

Entity Relationship Model

  • Models an enterprise as a collection of entities and relationships
  • Represented by an entity-relationship diagram

Normalization Theory

  • Formalize what designs are bad, and test for them

Deciding "what relation schemas should we have and how should the attributes be distributed among them" is which kind of decision in logical design?

تفاصيل المصدرالفصل 1 · الشرائح ⁦17–19⁩
المصدر
الفصل 1 · الشرائح ⁦17–19⁩

Database engine and storage managementالمحرك ومدير التخزين

The database engine: storage, query processing, transactions

Database engine (slide 22)

  • Storage manager
  • Query processor
  • Transaction manager
Storage manager
A program module that provides the interface between the low-level data stored in the database and the application programs and queries submitted to the system.
  • Responsible for: interaction with the OS file manager; efficient storing, retrieving and updating of data.
  • Issues: storage access; file organization; indexing and hashing.

Which database engine component interacts with the OS file manager and provides the interface between low-level stored data and application programs?

تفاصيل المصدرالفصل 1 · الشرائح ⁦22–23⁩
المصدر
الفصل 1 · الشرائح ⁦22–23⁩

Query processingمعالجة الاستعلامات

  1. 1

    Parsing and translation

  2. 2

    Optimization

  3. 3

    Evaluation

  • Alternative ways of evaluating a query: equivalent expressions; different algorithms for each operation.
  • Cost difference between a good and a bad way of evaluating a query can be enormous.
  • Estimating the cost of operations depends critically on statistical information about relations which the database must maintain; statistics for intermediate results are also estimated.

A query has just been submitted. Which sequence does the query processor follow before results come back?

تفاصيل المصدرالفصل 1 · الشرائح ⁦24–25⁩
المصدر
الفصل 1 · الشرائح ⁦24–25⁩

Transaction managementإدارة المعاملات

The database engine: storage, query processing, transactions

Transaction
A collection of operations that performs a single logical function in a database application.
Transaction-management component
Ensures that the database remains in a consistent (correct) state despite system failures (e.g., power failures and operating system crashes) and transaction failures.
Concurrency-control manager
Controls the interaction among the concurrent transactions, to ensure the consistency of the database.

Two bank clerks withdraw money from the same account balance at the same moment. Which part of the database engine is responsible for coordinating their transactions so the balance stays correct?

تفاصيل المصدرالفصل 1 · الشريحة ⁦26⁩
المصدر
الفصل 1 · الشريحة ⁦26⁩

Database users and architectureالمستخدمون والبنية

Database users and database architecture

Database users and administrators (slide 27)
User (slide 27)Interacts through
Naive users (tellers, agents, web users)use application interfaces
Application programmerswrite application programs
Sophisticated users (analysts)use query tools
Database administratorsuse administration tools

Database architecture (slide 29)

  • Centralized
  • Client-server
  • Parallel (multi-processor)
  • Distributed
  • The architecture is greatly influenced by the underlying computer system on which the database is running.
تفاصيل المصدرالفصل 1 · الشرائح ⁦27–29⁩
المصدر
الفصل 1 · الشرائح ⁦27–29⁩

الخلاصة

تفاصيل المصدر
المصدر
الفصل 1

خريطة الفصل

    1. 1مقدمة الفصل
  1. Database management systems and the drawbacks of file systemsنظم إدارة قواعد البيانات وعيوب أنظمة الملفات

    1. 2Database Management System (DBMS)نظام إدارة قواعد البيانات
    2. 3Drawbacks of using file systems to store dataعيوب أنظمة الملفات
  2. Levels of abstraction, schemas, instances and data independenceمستويات التجريد والمخططات والنسخ واستقلال البيانات

    1. 4Levels of abstractionمستويات التجريد
    2. 5Schemas and instancesالمخطط والنسخة
    3. 6Data independenceاستقلال البيانات
  3. Data modelsنماذج البيانات

    1. 7Data modelsنماذج البيانات
    2. 8Object-relational data models and XMLالكائني العلائقي وXML
  4. DDL, DML and SQLلغة تعريف البيانات ولغة معالجتها وSQL

    1. 9Data Definition Language (DDL)لغة تعريف البيانات
    2. 10DML and SQLDML و SQL
    1. 11Database designتصميم قاعدة البيانات
  5. The database engine: storage, query processing, transactionsمحرك قاعدة البيانات: التخزين والاستعلام والمعاملات

    1. 12Database engine and storage managementالمحرك ومدير التخزين
    2. 13Query processingمعالجة الاستعلامات
    3. 14Transaction managementإدارة المعاملات
  6. Database users and database architectureمستخدمو قاعدة البيانات وبنيتها

    1. 15Database users and architectureالمستخدمون والبنية
    1. 16الخلاصة