Sunteți pe pagina 1din 37

Why Databases Characteristic of data in databases Types of database management systemsrelation model Hierarchical model

The

term database refers to a collection of data that is multidimensional in the sense that internal links between its entries make the information accessible from a variety of perspectives.

2-2

Historically,

each application tend to be implemented as a separate system with its own collection of data. This meant much of the information required by an organization was duplicated throughout the company. While many but different related items were stored in separate systems.

2-3

In

this setting, database systems emerged as a means of integrating the information stored and maintained by a particular organization.

2-4

2-5

Such

integrated pools of information provided a valuable resource with which management decisions could be made , assuming the information could be accessed in a meaningful way.

2-6

To

provide different users access to different information within the database, database systems often rely on schemas and subschemas. A schema is a description of the entire database structure that is used by the database software to maintain the database. A subschema is a description of only that portion of the database relevant to a particular users needs.
2-7

A schema for a university database would indicate that each student record contains such items of the student as his:

Current address Phone number Academic records. Each student record is linked to students faculty advisor.

In order to keep the registrar from using the linkage to obtain privilege information about the faculty . Registrars access to the DB must be restricted to a subschema.
2-8

The

subschema does not include the history of employments. Under this subschema the registrar could fine out which faculty member is a particular students advisor. But he could not find access to additional information about the faculty member.

2-9

typical database application involves multiple software layers, which we will group into two major layers:

An application layer Database management layer.

The

application software handles the communication with the user of the database .

It does not directly manipulate the DB.

2-10

Database

Management System (DBMS): A software layer that manipulates a database in response to requests from applications

Distributed

Database: A database stored on multiple machines


DBMS will mask this organizational detail from its users

Data

independence: The ability to change the organization of a database without changing the application software that uses it

2-11

Database

model: A conceptual view of a

database

Relational database model

2-12

Relation:

A rectangular table

Attribute: A column in the table Tuple: A row in the table

2-13

2-14

Avoid

multiple concepts within one relation

Can lead to redundant data Deleting a tuple could also delete necessary but unrelated information

2-15

Decomposition:

Dividing the columns of a relation into two or more relations, duplicating those columns necessary to maintain relationships

Lossless or nonloss decomposition: A correct decomposition that does not lose any information

2-16

2-17

2-18

2-19

2-20

Select:

Choose rows Project: Choose columns Join: Assemble information from two or more relations

2-21

X:

A 2 3 4 5

B 5 3 3 3 2

C 7 3 2 2 8

TEMP SELECT from X where B > C RESULT PROJECT A from TEMP Answer will be 4

2-22

X:

A 2 3 4 4 5

B 5 3 4 4 2

C 7 6 22 2

select A, B from X where X.B > X.C Answer: 4,4

2-23

X:

A 7 2 1

B s z u

Y:

C t t r

D 3 8

select X.A, X.B, Y.C from X, Y where X.A > Y.D Answer: 7,s,t

2-24

X:

A 2 5

B s z

Y:

C t r w

D 1 3 2

Result JOIN X and Y where X.A < Y.D

Answer: 2, s, r, 3

2-25

X:

A B C 2 5 7 3 3 3 4 4 2 5 2 8 TEMP SELECT from X where B = C RESULT PROJECT B from TEMP


Answer: 3

2-26

X:

A 2 3 4 5 5

B 5 3 4 2 2 2

C 7 6 2 2 2

select A, B from X where X.B = X.C Answer: 5,2

2-27

X:

A 2 2 5

B s s z

Y:

C t r w w w

D 1 3 2 2

Temp JOIN X and Y where X.A = Y.D Result PROJECT X.B, Y.C from Temp Answer: s, w

2-28

X:

A 7 2

B s z

Y:

C tt r

D 3 2

select Y.C from X, Y where X.A < Y.D Answer: t

2-29

X:

C D t t 1 r 3 r w 22 w w Temp JOIN X and Y where X.A > Y.D Result PROJECT X.B, Y.C from Temp

A 2 2 5 5

B s s z z z

Y:

Answer:

X.B s z z z

Y.C t t r w

2-30

2-31

2-32

2-33

2-34

2-35

hierarchical database model is a data model in which the data is organized into a tree-like structure. The structure allows representing information using parent/child relationships: each parent can have many children, but each child has only one parent (also known as a 1-to-many relationship)

2-36

2-37

S-ar putea să vă placă și