Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Introduction to Database Systems دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 1.

Similar presentations


Presentation on theme: "An Introduction to Database Systems دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 1."— Presentation transcript:

1 An Introduction to Database Systems دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 1

2 Lecturer: Naiem Yousefifard دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 2

3 Chapter 1 An Overview of Database Management دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 3

4 What is a Database System? Computerized system whose overall purpose is to : Store information Allow users to retrieve and update information on demand دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 4

5 Basic Definitions Data : What is actually stored in the database Information : Meaning of data as understood by user Mini-World : Some part of real world about which data is stored in a database (Student grades and transcripts at a university) Database : A collection of related data دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 5

6 Stages in the Life of a Database Definition: Specifying structures of tables and data to be stored Construction: Populating tables with data Manipulation: Queries, updates, deletes, etc دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 6

7 DBMS : Database Management System A general-purpose software that enables users to : Define Construct Maintain various databases. i.e. Oracle, Dbase IV, MS SQL Server دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 7

8 Database System Database + DBMS Software دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 8

9 Simple Database System Environment دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 9

10 Typical DBMS functionality Multimedia Databases Geographic Information Systems (GIS) Data Warehouses Real-Time & Active Databases Commercial Databases دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 10

11 DBMS Advantages Define Mini-World Construct : putting data in a database system Manipulation Sharing : Sharing data between users Protection : Prevent unauthorized accesses Maintenance : Backup, Restore, Conversion, Replication دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 11

12 University Conceptual Model Mini-World Part of a UNIVERSITY environment Entities STUDENTs COURSEs SECTIONs INSTRUCTORs Relationships SECTIONs are of specific COURSEs STUDENTs take SECTIONs COURSEs have prerequisite COURSEs INSTRUCTORs teach SECTIONs COURSEs are offered by DEPARTMENTs دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 12

13 دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 13

14 Main Characteristics of the Database Approach Self-Describing nature of a database system Insulation between programs and data Data-Abstraction Support of multiple views of the data Sharing of data and multi-user transaction processing Atomicity Consistency Isolation Durability دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 14

15 Main Characteristics of the Database Approach Self-Describing nature of a database system Use meta-data & database catalog Not available in filing systems دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 15

16 Main Characteristics of the Database Approach Self-Describing nature of a database system دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 16

17 Main Characteristics of the Database Approach Insulation between programs & data Hard-code needed in filing systems Program-Data Independent in database system Changing Database files not affected in program structure دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 17

18 Main Characteristics of the Database Approach Data Abstraction Hide database physical structure from programs Programs only use logical structure of a database دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 18

19 Main Characteristics of the Database Approach Support of multiple views of the data دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 19

20 Main Characteristics of the Database Approach Sharing of data and multi-user transaction processing Simultaneous access to data Should be managed in two levels :  Application Logic  DBMS دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 20

21 Main Characteristics of the Database Approach Atomicity All part of the transactions must be executed concurrently Log all actions دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 21

22 Main Characteristics of the Database Approach Consistency requirement that any given database transaction must only change affected data in allowed ways Any data written to the database must be valid according to all defined rules, including constraints, cascades, triggers, and any combination thereof دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 22

23 Main Characteristics of the Database Approach Isolation determines how transaction integrity is visible to other users and systems دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 23

24 Main Characteristics of the Database Approach Durability Is the ACID property which guarantees that transactions that have committed will survive permanently ACID :  Atomicity  Consistency  Isolation  Durability دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 24

25 دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 25 Chapter 2 Data Modeling Using the Entity-Relationship (ER) Model

26 دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 26 Entity-Relationship (ER) Model The ER model is a high-level conceptual data model. It has not been implemented in any commercial DBMS, but is a powerful short hand often used in database design for a first rendition of the mini-world. ER model was introduced by Dr.Peter Chen in 1976, and is now the most widely used conceptual data model.

27 Entity-Relationship (ER) Model Definitions An Entity is an object in the mini-world An Attribute of an entity can have a value from a value-set (domain) Each entity belongs to some one entity type Entities in one entity type have the same attributes so each entity type is a set of similar entities. دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 27

28 دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 28 Entity-Relationship (ER) Model Definitions A key attribute of an entity type is one whose value uniquely identifies an entity of that type A combination of attributes may form a composite key If there is no applicable value for an attribute, that attribute is set to a null value.

29 Entity-Relationship (ER) Model Entity Type / Entity Set دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 29 Entity Type (Intension): EMPLOYEE Attributes: Name, Age, Salary Entity Set (Extension): e 1 = (John Smith, 55, 80000) e 2 = (Joe Doe, 40, 20000) e 3 = (Jane Doe, 27, 30000).

30 دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 30 Entity-Relationship (ER) Model Attributes can be Composite / Simple (Atomic) Single-valued / Multivalued Stored / Derived Key / None-key.

31 Entity-Relationship (ER) Model Attribute Examples دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 31 Name = John Doe Birthdate = May 10, 1989 Age = 9 Degree = null SSN = 123456789 Name = John Doe Birthdate = May 10 Birthyear = 1989 Age = 9 Degree = null SSN = 123456789 Name = Jane Doe Birthdate = July 11, 1960 Age = 38 Degree = B.S., M.S. SSN = 987654321

32 دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 32

33 دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 33

34 دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 34 EMPLOYEE Name, SSN, Sex, Address, Salary, Birthdate, Department, Supervisor, {Works on ( Project, Hours)} WORKS_FOR EMPLOYEEDEPARTMENT 1N Name SSN... Relationship instances of WORKS_FOR: {(KV, CS), (Pan, EE),...}

35 ER Diagram for COMPANY Database دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 35

36 دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 36

37 دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 37

38 Entity-Relationship (ER) Model Relationship When an attribute of one entity type refers to another entity type دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 38

39 Entity-Relationship (ER) Model Relationship Type A relationship type R among n entity types E 1,…,E n is a set of relationship instances r i, where each r i associates n entities (e 1,…,e n ), each e j  E j. The degree n of a relationship type is the number of participating entity types. (Binary, Ternary) In the ER model relationships are explicitly represented. دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 39

40 Entity-Relationship (ER) Model Entity Roles Each entity type in a relationship type plays a particular role that is described by a role name. Role names are specially important in recursive relationship types where the same entity participates in more than one role: دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 40 Employee Supervision Supervisor 1N Supervisee

41 Entity-Relationship (ER) Model Weak Entity Type A weak entity type is one without any key attributes of its own Entities belonging to a weak entity type are identified by being related to another entity type ( called identifying owner) through a relationship type ( called identifying relationship), in combination with values of a set of its own attributes (called partial key) دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 41

42 Entity-Relationship (ER) Model Relationship Attributes Relationship types can have attributes as well In case of 1:1 or 1:N relationships, attributes can be migrated to one of the participating entity types Think of a binary relationship type in terms of attributes دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 42

43 Entity-Relationship (ER) Model Relationship Attributes دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 43

44 Entity-Relationship (ER) Model دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 44 Relationship Attributes

45 Entity-Relationship (ER) Model Structural Constraints Cardinality ratio:Limits the number of relationship instances an entity can participate in, e.g. 1:1, 1:N, M:N Participation constraint: If each entity of an entity type is required to participate in some instance of a relationship type, then that participation is total; otherwise, it is partial دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 45

46 Entity-Relationship (ER) Model Structural Constraint Min, Max A more complete specification of the structural constraint on a relationship type can be given by the integer pair (min, max), which means an entity must participate in at least min and at most max relationship instances دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 46

47 دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 47

48 Entity-Relationship (ER) Model Ternary Relationship Generally represents more information than 3 binary relationships دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 48

49 دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 49


Download ppt "An Introduction to Database Systems دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 1."

Similar presentations


Ads by Google