Professional Documents
Culture Documents
) ( Data Base
DBMS
Data Base Management Systems
.
.
.
.
.
-:
-
.
-
.
-
.
1
.
-
.
-
.
- -:
- .
- .
- .
- .
- .
- .
- .
-:
) (
.
Records . Fields
-:
0778989898 01
0771123456 02
2
.
-:DATA :
) (65 .
- -:Information . :
) (6 ) (5 65 .
- - Table :
. .
-- Quires :
.
18.
-- Record :
3
.
- - Field
.1 Data Consolidation
.
.2 Data Sharing
DBMS .
.3 Data Protection
dbms )
.. ( DBMS
4
.
). (undo
.1 Hierarchical DBMS
.2 Network DBMS
.3 Relational DBMS
5
.
Relational Model
: Edgard Franck Codd 1970
) (
.
Relational Database Management System - RDBMS
- Relational Data Model Concepts
.1 )(
.2
.3
.
- :
.1 .
.2 .
.3 .
1970 Codd .
. Codd
Relation
Fields Attributes
Relation Tuples
.
SQL . ORACLE
6
.
Implicit
Relationships Explicit Relationships
.
] [ ] [ . ] ]
] [
.
7
.
Relational Algebra
Group Theory
) (
:
:
.
:Union )(U
.R1 U R2 :
:
8
.
) ( : Intersection
)( R1 R2
. .
:
: R1 .
: R2 .
:
) ( R1 R2 :
9
.
:(- ) Difference
)(
.
10
.
R2-R1
R2 R1
.
:
:
-1 : Selection
11
.
/ Rows
:
-2 : Projection
Columns
:
12
.
-1 ): (x
:
-2 : () Division
R3=R1R2
:
13
.
R1 R2
:
-3 :Join
SQL
.
.
14
.
/
:
15
.
:
.
-:
.1 -:One - to - many
16
.
)
( Primary Table )
( Related Table N:1
.
10
20
30
* : Pk
:
17
.
10 1
20 2
10 3
30 4
: .
:
:
one to mony .
mony to one .
.2 -:One - to - One
) :
( . 1:1
18
.
10
20
30
: Pk
200 20 10 1
900 30 20 2
327 25 30 3
: Pk
: Fk
one to one
.one to one
.3 -:Many - to - many
) (
) (
) (
. . N:M
19
.
-:
:
-1 / .
-2 .
-3
.
-4
.
20
.
:
:
; CREATE DATABASE MyDatabase
MyDatabase .
:
; DROP DATABASE MyDatabase
MyDatabase .
: Tables
.
21
.
:
:
. SQL
( CREATE TABLE MyTable
ID INT,
FullName VARCHAR(50),
BirthDate DATETIME
)
MyTable
50 .DataTime
:
:
;DROP TABLE MyTable
MyTable .
:
:
;ALTER TABLE MyTable ADD Age int
22