Lecture 2 (1).ppt

21
Lesson 2 Database Environment

Transcript of Lecture 2 (1).ppt

Page 1: Lecture 2 (1).ppt

Lesson 2

Database Environment

Page 2: Lecture 2 (1).ppt

Lesson outcomes

By the end of the lesson, students should be able to• Describe ANSI-SPARC 3-level database architecture and state

the objectives of such architecture.

• Describe external, conceptual and internal levels of the ANSI-SPARC architecture and the relationships between them.

• State the meaning of logical and physical data independence.

• Distinguish between DDL and DML.

• Identify classification of data models.

• State the purpose/importance of conceptual modelling.

Page 3: Lecture 2 (1).ppt

ANSI-SPARC Architecture

3

• ANSI-SPARC stands for American National Standards Institute, Standards Planning And Requirements Committee.

• It is an abstract design standard for a Database Management System (DBMS), first proposed in 1975.

• Most modern commercial DBMS are based on this architecture

Page 4: Lecture 2 (1).ppt

ANSI-SPARC Three-Level Architecture

4 Pearson Education © 2009

Page 5: Lecture 2 (1).ppt

The Three-Level of the ANSI-SPARC Architecture

• External Level– Users’ view of the database. – Describes that part of database that is relevant to a particular user.

• Conceptual Level– Community view of the database. – Describe what data is stored within the whole database and how the data

is inter-related. The conceptual level does not specify how the data is physically stored.

– DBA relevant. Hardware & software independent

• Internal Level (incl. Physical storage)– Physical representation of the database on the computer. – Describes how the data is actually stored (e.g., data type, index) in the

database and the hardware.

5 Pearson Education © 2009

Page 6: Lecture 2 (1).ppt

Differences between the Three Levels of ANSI-SPARC Architecture

6 Pearson Education © 2009

Page 7: Lecture 2 (1).ppt

Reasons/Objectives of Three-Level Architecture

• It allows independent customized user views: Each user should be able to access the same data, but have a different customized view of the data. These should be independent: changes to one view should not affect others.

• It hides the physical storage details from users: Users should not have to deal with physical database storage details. They should be allowed to work with the data itself, without concern for how it is physically stored.

• The database administrator should be able to change the database storage structures without affecting the users’ views: From time to time rationalizations or other changes to the structure of an organization’s data might be required.

7 Pearson Education © 2009

Page 8: Lecture 2 (1).ppt

Reasons/Objectives of Three-Level Architecture

• The internal structure of the database should be unaffected by changes to the physical aspects of the storage: For example, a changeover to a new disk.

• The database administrator should be able to change the conceptual or global structure of the database without affecting the users: This should be possible while still maintaining the desired individual users’ views.

8 Pearson Education © 2009

Page 9: Lecture 2 (1).ppt

Data Independence

• Logical Data Independence– Refers to immunity of external schemas to changes in conceptual

schema.– Conceptual schema changes (e.g. addition/removal of entities)

should not require changes to external schema or rewrites of application programs.

• Physical Data Independence– Refers to immunity of conceptual schema to changes in the

internal schema.– Internal schema changes (e.g. using different file organizations,

storage structures/devices) should not require change to conceptual or external schemas.

9 Pearson Education © 2009

Page 10: Lecture 2 (1).ppt

Database Languages

• Data Definition Language (DDL)– Allows the DBA or user to describe and name entities,

attributes, and relationships required for the application– plus any associated integrity and security constraints.

• Data Manipulation Language (DML)– Provides basic data manipulation operations on data

held in the database.

• Fourth Generation Languages (4GLs)

10 Pearson Education © 2009

Page 11: Lecture 2 (1).ppt

Data Model

Integrated collection of concepts for describing data, relationships between data, and constraints on the data in an organization.

• Data Model comprises:– a structural part;– a manipulative part;– possibly a set of integrity rules.

11 Pearson Education © 2009

Page 12: Lecture 2 (1).ppt

Data Model

• Purpose– To represent data in an understandable way.

• Categories of data models include:– Object-based– Record-based– Physical.

12 Pearson Education © 2009

Page 13: Lecture 2 (1).ppt

Data Models

• Object-Based Data Models– Entity-Relationship– Semantic– Functional– Object-Oriented.

• Record-Based Data Models– Relational Data Model– Network Data Model– Hierarchical Data Model.

• Physical Data Models

13 Pearson Education © 2009

Page 14: Lecture 2 (1).ppt

Relational Data Model

14 Pearson Education © 2009

Page 15: Lecture 2 (1).ppt

Network Data Model

15 Pearson Education © 2009

Page 16: Lecture 2 (1).ppt

Hierarchical Data Model

16 Pearson Education © 2009

Page 17: Lecture 2 (1).ppt

Steps Towards Database Development

• Construct Conceptual Model

• Construct Logical Model

• Implement Physically

17 Pearson Education © 2009

Page 18: Lecture 2 (1).ppt

Conceptual Modeling

• Conceptual schema is the core of a system supporting all user views.

• Should be complete and accurate representation of an organization’s data requirements.

• Conceptual modelling is process of developing a model of information use that is independent of implementation details.

• Result is a conceptual data model.

18 Pearson Education © 2009

Page 19: Lecture 2 (1).ppt

Conceptual Modeling

• Similar to programming, before you actually sit in front of the terminal to code programming steps using a programming language (e.g. C++), you should have a broad idea (algorithm) how the solution should be.

• In programming, usually, this broad solution is visualize in flowcharts or sometimes pseudocode.

• Once the flowcharts are there, the process of mapping each item in the flowcharts to an actual programming code can be done smoothly.

• In database, the broad idea is visualized or modelled in two aspects: structure + operation

19

Page 20: Lecture 2 (1).ppt

Conceptual Modeling

• The structure is often depicted in a diagrammatic form. The popular ones are called Entity-Relationship Diagram (ERD) and UML Class Diagram.

• As for the operation, if UML diagram is used, then the operations normally will be included together in the diagram. As for ERD, the operations will be modelled separately, for example, using relational algebra.

20 Pearson Education © 2009

Page 21: Lecture 2 (1).ppt

Lesson Summary

• ANSI-SPARC 3-level architecture provides 3 different views of the same database. Topmost view (external) is different for each type of users. Middle view (conceptual) is a complete view as seen by the database designer. The innermost view depends on the DBMS selected.

• Database can be constructed using different approaches (data models).

• Whichever data model selected, the development of a database starts with conceptual modeling, followed by logical modeling and ends with physical implementation itself.