Mr.Warawut Khangkhan
Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter 5 5 5 5 5 5 5 5 Database SystemDatabase SystemDatabase SystemDatabase SystemDatabase SystemDatabase SystemDatabase SystemDatabase System
Mr.Warawut Khangkhan
e-Mail: [email protected]
Social Network: www.facebook.com/AjWarawut
������������������������
Mr.Warawut KhangkhanChapter 5 Database System2
������������������������ (File System)(File System)(File System)(File System)(File System)(File System)(File System)(File System)
��������
���� ��� ���
Mr.Warawut Khangkhan3 Chapter 5 Database System
������� ���������
������������������������� ����������������������������� (Bit)
� ��������� (Character)
������ (Field)
� ��������/�������
Mr.Warawut KhangkhanChapter 5 Database System4
� ��������/�������(Record)
� ��� (File)
��������������������������������������� ���������!�"����#�"��$� (Data Redundancy)
� ��� �%&����"�#�����#�"��$� (Data Inconsistency)
� ��� �%&��'��(������#�"��$� (Data Anomaly)� ��� �%&��'��(������#�"��$� (Data Anomaly)
� ��� �%�)*���&����#�"��$� (Data Dependency)
Mr.Warawut Khangkhan5 Chapter 5 Database System
����������������������
Mr.Warawut KhangkhanChapter 5 Database System6
������������������������ (File System)(File System)(File System)(File System)(File System)(File System)(File System)(File System)
��������
���� ��� ���
Mr.Warawut Khangkhan7 Chapter 5 Database System
������� ���������
���������������������� (Database System)(Database System)(Database System)(Database System)(Database System)(Database System)(Database System)(Database System)
��������
���� ��� ���
Mr.Warawut Khangkhan8 Chapter 5 Database System
������� ���������
���������������������� (Database System)(Database System)(Database System)(Database System)(Database System)(Database System)(Database System)(Database System)
�+��,-# �� %���#�"��$�/�0�����&��'��(����1��,$��!������� 2����2��#&�"#�������� ,$����� � �$1� 1�������2�������1��������3��"��$� (DBMS: Database Management System) �'�0����&��#Database Management System) �'�0����&��#����"�#��&�&��/4��#�#����1���'�0���5�"#��%�������#6$"5�" ������#��)�����/��#+��/�0/!#��%������% ����������� (Database System)�
Mr.Warawut Khangkhan9 Chapter 5 Database System
������������������������������������������� �"��$� (Data)
� 7���1��� (Hardware)
� �����1��� (Software) �"1�% Database Management System : DBMSManagement System : DBMS
� 6$"5�" (User) �"1�% Programmer, Database Administrator (DBA)
�Procedure ���0���"�#���� ��!&�0#/�02)�1��������+���DBA �!+�� �"�'�0���������3��"��$� ���,-#������������������"5�"3��"��$� Mr.Warawut Khangkhan10 Chapter 5 Database System
Application Interface
Procedure
Query/ReportTools
ApplicationSoftware
End UserProgrammer / DBA
Mr.Warawut Khangkhan11 Chapter 5 Database System
DBMSDataRepository
DataDictionary
HardwareSystemSoftware
ServerDatabase
������������������������������������������������
View 1 View 2 View 3...
Conceptual
External
Level
Conceptual
Mr.Warawut Khangkhan12 Chapter 5 Database System
Conceptual
Schema
Internal
Schema
Database Physical Data
Level
Internal
Level
1��� ���#/�0���%��"��$���#6$"5�"
View 1 View 2 View 3...
Conceptual
Schema
External
Level
Conceptual
Level
• �)*������� ���#��#6$"5�" • �(���,-#�"��$�5����89�:���� /�0 �% �"�)*�
�$)�%#+���2��#&�"#��#�"��$�• 2��#&�"#�"��$�5��������� ��1)��)��0�� )��
Mr.Warawut KhangkhanChapter 5 Database System13
Internal
Schema
Database Physical Data
Internal
Level
• 2��#&�"#�"��$�5��������� ��1)��)��0�� )��� ���#��#6$"5�"
• ���!�&���"��$��-#�-����$%���� ���#/�06$"5�"�"�#�� 2�� �%�!�)*��"�#�)*��"��$��$)1�������������/�0�����;� �"5�3��"��$����#
View 1 View 2 View 3...
Conceptual
Schema
External
Level
Conceptual
Level
• �)*������� ���#��#3��"��$� • �(���5+"/���%���"��$�5��"#/�0,$������;�5�
Mr.Warawut KhangkhanChapter 5 Database System14
Internal
Schema
Database Physical Data
Internal
Level
• �(���5+"/���%���"��$�5��"#/�0,$������;�5�3��"��$� 1���"��$��+�%����&��'��(������%# �
• �)*�:'��#2��#&�"#�"��$�/�05�"1/�2��#&�"#/#��:'��#�"��$����#/�0��;���$%5�3��"��$�
• �'�0�5+"#%��%����(���,-#2��#&�"#��#�"��$��%#< /�0��;���$%5�3��"��$�����
View 1 View 2 View 3...
Conceptual
Schema
External
Level
Conceptual
Level
� �)*������� ���#/�0�!�&��2��#&�"#/#��:'��#3��"��$�
� �(���5+"/���%�"��$�,$������;���%# �5�3��"��$� ��� �(���,-#2��#&�"#�"��$� �����"��$� )���:/����",-#�"��$� ������� ����"��$� ������ � )��,-#�����&�������/�05�1+�%#�����;�
Mr.Warawut KhangkhanChapter 5 Database System15
Internal
Schema
Database Physical Data
Internal
Level
������ � )��,-#�����&�������/�05�1+�%#�����;��"��$� ���!+�� Index 1����������� Record �"��$�
MappingMappingMappingMapping� �)*���,%�/��� ���#��&,)=������5������/�0&$#��%
)��#�����/�0�0!��% &��,1�%#����)*� 2 ���89� ��#����Conceptual / Internal Mapping – �'�0��!2��#&�"#��#�"��$�5������ Conceptual ��!+��2��#&�"#��#
Mr.Warawut KhangkhanChapter 5 Database System16
��#�"��$�5������ Conceptual ��!+��2��#&�"#��#Record 1�� Field /�0�! )5�"�����;��"��$�
�External / Conceptual Mapping – �'�0��!+��2��#&�"#��# Record 1�� Field 5+"&��,������ �����"�#�� +���� ���#�%#< ��#6$"5�"
MappingMappingMappingMappingExternal View 1
EmpId FName LName Age Salary
External View 2
EmpId LName ProNo
Conceptual View EmpId FName LName Age Salary ProNo
Mr.Warawut KhangkhanChapter 5 Database System17
Internal View struct EMPLOYEE {
int EmpId;
int ProNo;
char FName[15];
char LName[15];
struct date DateOfBirth;
float Salary;
struct EMPLOYEE *next;
}index EmpId; index ProNo;
����������������������������������� ���������3��"��$� (Database Management System : DBMS) – �)*������1���&!+������+�1�������3��"��$� �-0#�)*��&���������#��+�%#6$"5�"���3��"��$� /!+�"/�05���&�"# �����5�"�"��$� +���)���)� #
Mr.Warawut KhangkhanChapter 5 Database System18
3��"��$� /!+�"/�05���&�"# �����5�"�"��$� +���)���)� #3��"��$�
� 5���/!#����3��"��$����"�#6%� DBMS / �����#
�������� DBMS
� �������������� �� ������� (User View)
DBMS
Schema
Mr.Warawut KhangkhanChapter 5 Database System19
Subschema
B
Subschema
C
Subschema
A
User 1 User 2 User 3 User 4 User 5
������������������ �������������� !"�#�����$��%&� ��� ��!
���������������� DBMSDBMS
� �������� !" ����'���� ��! – �4�� >:8�����"��$�(Data Definition Language : DDL)”�DDL �)*�:8/�0)����� )�"��� ��!&�0# ����9� 1��
�?��9@�/�05�"5����!+��2��#&�"#1���(�������������?��9@�/�05�"5����!+��2��#&�"#1���(��������������#�"��$� ���������&��'��(���+�%#�"��$�5�3��"��$� 5���&�"#3��"��$���������"�#�!+��2��#&�"#5+"����"��$�1�"� 6$"�$1�3��"��$���#���"�#���/! >'��� ����"��$�(Data Dictionary: DD)” 5�3��"��$�����"��
Mr.Warawut Khangkhan20 Chapter 5 Database System
���������������� DBMSDBMS
� �������� !" ����'���� ��! – �4�� >:8�����"��$�(Data Definition Language : DDL)”������������� (Data Dictionary: DD) ��1&�#
�����������#�"��$�/��#+��/�0����$%5�3��"��$� �-0#�������������#�"��$�/��#+��/�0����$%5�3��"��$� �-0#��)����� )�"�� ��0� ������ )���:/ 1�������"#��#�"��$� ������+���+� ��#�"��$����� ��%� ��,$������5�"2��6$"5�"��5��"# ���! )5�"�'�0�&�"#��#�����5��"# �)*��"�
Mr.Warawut Khangkhan21 Chapter 5 Database System
���������� ������ ��� ���������
��! )5�"�)*����3�5����!+�����1)��"��$�5���+�%#�������2)�1��� �"
� �)*�����0�#���&!+������!� #���83��"��$� +��"�#��2��#&�"#&%��5�/�0�"�#1�" � ��/!5+"�����2��#&�"# �"2��#&�"#&%��5�/�0�"�#1�" � ��/!5+"�����2��#&�"# �"#%��-��
Mr.Warawut Khangkhan22 Chapter 5 Database System
���������� ������ ��� ���������
� �%���������!�"����#�"��$� ���0�#��5���+�%#�����/!'��� ����"��$� ��/!5+"/���%�"��$�5�/�0,$������;� )1�"� 1�������;� �"2��5�"��0��%��%# � �-0#+�'��%�"��$�����,$������;���!1�%5�"��0��%#����;��/!5+"1�" �'��%�"��$�����,$������;���!1�%5�"��0��%#����;��/!5+"1�" � �"/��/%�#/�
Mr.Warawut Khangkhan23 Chapter 5 Database System
���������� ������ ��� ���������
� �'�0�����%���0�,��5+"����"��$� ���0�#���������;��"��$��"������3��"��$� ��&��,�!+��&�/(�A5�����",-# �����5�" 1��1�" ��"��$� �" ��#���� ��1�" ��"��$�5+"6�� )������)*����# �-#��2��&�����-�� �"�"�� /!5+"5+"6�� )������)*����# �-#��2��&�����-�� �"�"�� /!5+"�"��$�/�0�����;��������0�,�� �"
Mr.Warawut Khangkhan24 Chapter 5 Database System
���������������� DBMSDBMS
� ���������( !"�������� ��! – �)*������#5��������;�1�������5�"�"��$�5�3��"��$� 2��5�"�!&�0# ��%� DBMS
� ����� ��� ���� ��
�� �� !"#�� $%� #
Physical Access Path
Mr.Warawut Khangkhan25 Chapter 5 Database System
3��"��$� 2��5�"�!&�0# ��%�“SELECT * FROM student;” �-0#�!&�0#�+�%�������)*��&"�/#5�����",-#�"��$����#����� “Logical Access Path (LAP)”
DBMS
&'"(�"�
")��� �*+ �
&'"(�"�
")��,��-%$�, !
&'"(�"�
")��-!��!.
/ � �+
Logical Access Path
���������������� DBMSDBMS
� ��������)������(�� ��! !"������������� ���������������� ���
(Manipulation) �"1�% ���'�0�
DBMS
� ����� ��� ���� ��
�� �� !"#�� $%� #
Schema
Mr.Warawut Khangkhan26 Chapter 5 Database System
(Manipulation) �"1�% ���'�0� 1/�� �� 1�" � 1��)���)� #�"��$� �-0#�!&�0#/�05�"5����!����������"��$�2��&%��5+�% ����%�)*��� %�:8 “DML (Data Manipulation Language)”
SchemaB
Schema
A
SchemaC
/ � �+
")��� �*+ �")��,��-%$�, ! ")��-!��!.
�� ������� ����� DBMSDBMSDBMSDBMSDBMSDBMSDBMSDBMSApplicationPrograms
ProgrammersProgrammersDatabaseSchema
DBADBA
Queries
UsersUsers
DMLPreprocessor
DDLCompiler
QueryProcessor
Mr.Warawut Khangkhan27 Chapter 5 Database System
ProgramObject Code
DictionaryManager
DatabaseManager
AccessMethods
FileManager
DBMSDBMS
SystemBuffers
Database andSystem Catalog
�� ������� ����� DBMSDBMSDBMSDBMSDBMSDBMSDBMSDBMSApplicationPrograms
ProgrammersProgrammersDatabaseSchema
DBADBA
Queries
UsersUsers
DMLPreprocessor
DDLCompiler
QueryProcessor
Mr.Warawut Khangkhan28 Chapter 5 Database System
ProgramObject Code
DictionaryManager
DatabaseManager
AccessMethods
FileManager
DBMSDBMS
SystemBuffers
Database andSystem Catalog
�)*��#��)�����&!�����# DBMS /!+�"/�01)�#�!&�0#����� )�)*�� ��!&�0#������%#/�0������"5� 1�"�&%# ))�����6��%�/�0 Database Manager
�� ������� ����� DBMSDBMSDBMSDBMSDBMSDBMSDBMSDBMSApplicationPrograms
ProgrammersProgrammersDatabaseSchema
DBADBA
Queries
UsersUsers
DMLPreprocessor
DDLCompiler
QueryProcessor
Mr.Warawut Khangkhan29 Chapter 5 Database System
ProgramObject Code
DictionaryManager
DatabaseManager
AccessMethods
FileManager
DBMSDBMS
SystemBuffers
Database andSystem Catalog
/!+�"/�0�)*������#5�������!&�0#����� (Query) 1�"�'���9�%�!�"�#��������6��%��"��$�&%��5� �������-#&%#�!�"�# )��# File Manager �'�0��!���������!�"�#���%� )
�� ������� ����� DBMSDBMSDBMSDBMSDBMSDBMSDBMSDBMSApplicationPrograms
ProgrammersProgrammersDatabaseSchema
DBADBA
Queries
UsersUsers
DMLPreprocessor
DDLCompiler
QueryProcessor/!+�"/�0�!�������%#< /�0���0���"�#���1+�%#�����;��"��$���/�0
DBA �!+���% �" '�"��/��#���&�������/�05�1+�%#�����;��"��$�
Mr.Warawut Khangkhan30 Chapter 5 Database System
ProgramObject Code
DictionaryManager
DatabaseManager
AccessMethods
FileManager
DBMSDBMS
SystemBuffers
Database andSystem Catalog
DBA �!+���% �" '�"��/��#���&�������/�05�1+�%#�����;��"��$� ������&%#+�"/�0 )5+" Access Method ���6�����1/�
�� ������� ����� DBMSDBMSDBMSDBMSDBMSDBMSDBMSDBMSApplicationPrograms
ProgrammersProgrammersDatabaseSchema
DBADBA
Queries
UsersUsers
DMLPreprocessor
DDLCompiler
QueryProcessor
Mr.Warawut Khangkhan31 Chapter 5 Database System
ProgramObject Code
DictionaryManager
DatabaseManager
AccessMethods
FileManager
DBMSDBMS
SystemBuffers
Database andSystem Catalog
/!+�"/�01)�#� ��!&�0#5��� %� DML 5+"�)*��=#��������3��'�0���",-#�"��$� 2���=#�������,$��=#��$%5�2)�1�����#3��"��$� 1���"�#/!#��%����� Query Processor
�� ������� ����� DBMSDBMSDBMSDBMSDBMSDBMSDBMSDBMSApplicationPrograms
ProgrammersProgrammersDatabaseSchema
DBADBA
Queries
UsersUsers
DMLPreprocessor
DDLCompiler
QueryProcessor
Mr.Warawut Khangkhan32 Chapter 5 Database System
ProgramObject Code
DictionaryManager
DatabaseManager
AccessMethods
FileManager
DBMSDBMS
SystemBuffers
Database andSystem Catalog
/!+�"/�01)�#� ��!&�0#5��� %� DDL 5+"�)*� Table ��# Meta-data �-0# Table �+�%�����,$������;���$%5� Catalog ��#�����%� ) �'�0�5�"�)*��"��$��"#��#5���)�����6��"��$�
�� ������� ����� DBMSDBMSDBMSDBMSDBMSDBMSDBMSDBMSApplicationPrograms
ProgrammersProgrammersDatabaseSchema
DBADBA
Queries
UsersUsers
DMLPreprocessor
DDLCompiler
QueryProcessor
Catalog Manager /!+�"/�0�$1�1�������
Mr.Warawut Khangkhan33 Chapter 5 Database System
ProgramObject Code
DictionaryManager
DatabaseManager
AccessMethods
FileManager
DBMSDBMS
SystemBuffers
Database andSystem Catalog
Catalog Manager /!+�"/�0�$1�1�����������",-# Catalog ��#���� ��� �$1�����",-# Table Meta-data ��#����
�������������������� DBMSDBMSDBMSDBMSDBMSDBMSDBMSDBMS1. ����� �'���� ��! (Database Size) – �-����$%���
�!��� Record2. ����#���������*+ ��)�,�#"$�� ���� (Number of
Concurrent Users)Concurrent Users)3. ��"�)-%),�$ (Performance) – �����;�5���
��",-#�"��$�, ���&��,1�������;�5����$"�������(System Recovery), ���&��,5������� �������:��'�"�����
Mr.Warawut Khangkhan34 Chapter 5 Database System
�������������������� DBMSDBMSDBMSDBMSDBMSDBMSDBMSDBMS4. �����"������-����� (Integration) – /!#�
�%�����2)�1���)��� ���1��3��"��$���0�, ����)C������� (Operating System: OS)”
5. !��./"�����0 (Features) – �%�%���)*���/!#�5. !��./"�����0 (Features) – �%�%���)*���/!#�+����$)���89���#�����1���/�0�)*�������89��D'�5�DBMS 1�%��6���:�9@� &%��5+�%�����������0�#����'�0��%��5����!+���������8���)���:�� ���!+��&�/(�A5�����",-#�"��$�/�0�'�"����� DMBS �����,-# ��5�"#�/�0#%� ���$%���)�������5�"#�/�0��"5�#%� 1��������
Mr.Warawut Khangkhan35 Chapter 5 Database System
�������������������� DBMSDBMSDBMSDBMSDBMSDBMSDBMSDBMS6. ����!)� !"������� (Vendor) – '���9 �"��
�����#�#���� �������0��&��# 1��&,��/#���#��
7. ���-�� (Cost) +�������# DBMS – �-����$%���&,��/#���#�� �2��� 1���#�0�� ���0�<&,��/#���#�� �2��� 1���#�0�� ���0�<
Mr.Warawut Khangkhan36 Chapter 5 Database System
���� �������������� ����������(Database Model)(Database Model)(Database Model)(Database Model)(Database Model)(Database Model)(Database Model)(Database Model)
5�"�(���,-#2��#&�"#1�����&��'��(���+�%#�"��$�:�5�3��"��$�
Mr.Warawut KhangkhanChapter 5 Database System37
����������� ����!�"������������ ����!�"�� �)*�3��"��$�/�0��2��#&�"#��%##%� � �����;��"��$�5�1�E��"��$��)*� Segment �����1�%��Segment 5�16�6�#�"� �"�% >2+�� (Node)” 2+��/�0��$%������%# ������% “2+���$� (Child Node)” &%����$%������%# ������% “2+���$� (Child Node)” &%��2+��/�0��$%������� ������% >2+��'%�1�% (Parent Node)” 1��2+��/�0��$%�������& � ������% “Root Node” �-0#���"�#���'��#2+��������/%����
� 2+��'%�1�%&��,���$� �"����% 1 2+�� 1�%2+���$�����'%�1�% �"�'��#2+��������/%���� ��������&��'��(����89�����% “One-to-Many Relationship”Mr.Warawut Khangkhan38 Chapter 5 Database System
����������� ����!�"������������ ����!�"�
Mr.Warawut KhangkhanChapter 5 Database System39
����������� ����!�"������������ ����!�"��� ��
� �������%�#���5���5�"#�
� ����",-#�"��$��%�"
� �%�+�������������"��$�/�0�"�#����������;� �'��
Mr.Warawut KhangkhanChapter 5 Database System40
� �%�+�������������"��$�/�0�"�#����������;� �'���"�#�4��2��#&�"#1�� Linked List /�0�"�#��'��������� (Pointer) ��� )��#�"��$� Record ,�� )���0��< �-# �%����5�"#������
����������#��$�%������������#��$�%�����2��#&�"#��"����3��"��$�1���!�������
� 3��"��$�1��������%� 2+���$�&��,��2+��'%�1�% �"����% 1 2+�� 1��2+��'%�1�%�;&��,��2+���$� �"����% 1 2+����%��������� ��������&��'��(����89����
Mr.Warawut KhangkhanChapter 5 Database System41
����% 1 2+����%��������� ��������&��'��(����89�����% “Many-to-Many Relationship”
����������#��$�%������������#��$�%��
Mr.Warawut KhangkhanChapter 5 Database System42
����������#��$�%������������#��$�%���� �� �%���"��!������0�#���&��'��(�
�&����"�#������#�
�� ��� �����1��3��"��$�/!
�"�%���"#�� ���0�#���"�#�!+�����&��'��(�
Mr.Warawut KhangkhanChapter 5 Database System43
�&����"�#������#�������)*����#����%
�"�#�!+�����&��'��(�5+"������ �/ ��"��$� /!5+"���)��0��1)�#2��#&�"#�"��$��-#�)*����0�#��
�������#!&����'��(��������#!&����'��(�� �)*�3��"��$�/�0��;��"��$� �"5����89���#��# 2 ���� (Table) 2��1�%#�)*�1,� (Row 1/� Record) 1��������� (Column 1/������ +���Attribute)
� 3��"��$����#&��'��(��-#)����� )�"���� %���#
Mr.Warawut KhangkhanChapter 5 Database System44
� 3��"��$����#&��'��(��-#)����� )�"���� %���#��#�"��$�+����# 1�%����#�����&��'��(�����"��Attribute 5�Attribute +�-0# �-#������"��$�1�%����#�% “Relation” +��� “Table”
�������#!&����'��(��������#!&����'��(�
Mr.Warawut KhangkhanChapter 5 Database System45
�������#!&�)���*�������#!&�)���*� �)*������3��"��$�����+�-0#/�0�����;��"��$�� ��!&�0# �"
�"����� �-0#&�0#/�0������������"��$�1���!&�0#5����!������5�< ��"�"����� ��,$�������% >���, (Object)” 1��3��"��$�/�0�!������;� Object
Mr.Warawut KhangkhanChapter 5 Database System46
(Object)” 1��3��"��$�/�0�!������;� Object
� �"��$�/�0�����;���$%5�3��"��$�������� ��,$���#�)*����, +��������;��� (�)���� �"���&������# Entity) 1�%�������;�������� 9���89�/�0������% “Attribute” �������������;�����#)����� )�"����(�� �-0#�)���� �"���'G��������#�����;��������$%�"��
�������#!&�)���*�������#!&�)���*Person
name
birthdate
Mr.Warawut KhangkhanChapter 5 Database System47
Student
entrydate
Employee
hiredate
Teacher Support
�������#!&�)���*�������#!&�)���*�� �
� 3��"��$����#���, &��,�����;��"��$�/�0���������"�� �"�)*���%#�� 2��
�� ��
� ���-#�"��$�+��< �"��$�����)��&�/(�:'�"����%3��"��$����#
Mr.Warawut KhangkhanChapter 5 Database System48
����"�� �"�)*���%#�� 2��&��,�����;��"��$�/�0�)*�Multi-valued �" �)*������"��!�����#3��"��$����#&��'��(�
�"����%3��"��$����#&��'��(�
������������&�&������������&�&� �)*�3��"��$�/�0'�H����3��"��$����#&��'��(� 2��1�%
��1,� ��� >��������I �-0#/!5+"/��� 9���89���#�"��$�5�<
� ����#�"��$��)*��������� ,���%�)*�����#1�����������
Mr.Warawut KhangkhanChapter 5 Database System49
� ����#�"��$��)*��������� ,���%�)*�����#1�����������
������������&�&������������&�&!"#$!%& '(")%* +%,)%-.*$/ ,0(1%,
��!- H�!� A 18,000
��!- H�!� B 15,000
��!- " �� A 10,000
��!- " �� B 12,500
�H�O� H�!� A 35,000
Mr.Warawut KhangkhanChapter 5 Database System50
�H�O� H�!� A 35,000
�H�O� H�!� B 37,500
�H�O� " �� A 25,000
�H�O� " �� B 20,000
�R H�!� A 20,000
�R H�!� B 18,000
�R " �� A 15,000
�R " �� B 12,500
������������&�&������������&�&
Mr.Warawut KhangkhanChapter 5 Database System51
����/�0 1 ��� :$��:� (Region)����/�0 2 ��� G�$�� (Season)����/�0 3 ��� &���6��� (Production Line)
������������&�&������������&�&
� ��1&�#�"��$�+������ ��/!5+"��������+��"��$� ��������/ �G�$��1��/ �:$��:�/! �"#%��-�� �"��
Mr.Warawut KhangkhanChapter 5 Database System52
/ �:$��:�/! �"#%��-�� �"����(��� “�D��� (Slicing)” �$��4������)*�&%�� < ��/�0�"�#���!����/%����
�$���N (Dicing)
������������&�&������������&�&� ��(��� “Slice and Dice” ����)*��/����/�05�"5���
������+��"��$���3��"��$� >��"���/1�����#�"��$�(Data Mart and Data Warehouse)I �/�������������% 1�����"�#!�!��)�#)����"�& (( ��!�&
Mr.Warawut KhangkhanChapter 5 Database System53
������% 1�����"�#!�!��)�#)����"�& (( ��!�&(Online Analytical Processing : OLAP)” �-0#�)*���������+��"��$��!�����/�0�����;���$%5�3��"��$� �'�0����+&�&��/4/�0��#������"�#����#6$"5�" 2��/�06$"5�" �%�!�)*��"�#�! )������+��%����
!�&����������!�&����������
Mr.Warawut KhangkhanChapter 5 Database System54
�����������)�+���������������)�+����(Centralized Database)(Centralized Database)(Centralized Database)(Centralized Database)(Centralized Database)(Centralized Database)(Centralized Database)(Centralized Database)
� �������;�3��"��$�1�� DBMS �"/�0 ���#������ 2��&%��5+�%���)*�4$�����#��#�#����
� 3��"��$����������&��,��#�����5�"#���6$"5�"+���� �"'�"������� �"'�"�����
Mr.Warawut Khangkhan55 Chapter 5 Database System
CentralDatabase
��������������������������������(Distributed Database(Distributed Database(Distributed Database(Distributed Database(Distributed Database(Distributed Database(Distributed Database(Distributed Database))))))))
� �������;�3��"��$� 1�� DBMS �"5�+��< &,�/�0+���+�� ��� 1�%�� ��������������'��������)*���#�����#
Mr.Warawut Khangkhan56 Chapter 5 Database System
��������������������������������(Distributed Database)(Distributed Database)(Distributed Database)(Distributed Database)(Distributed Database)(Distributed Database)(Distributed Database)(Distributed Database)
3��"��$�1���������#,$��!1���)*� 2 �����%�� �"1�%�Homogeneous System - 1�%�� ���#�5�
�����1��� DBMS ������������ �$)1����#�"��$��-#�+������� ���!�"��$��%# ����5�"#��-#/! �"#%� �%�+������� ���!�"��$��%# ����5�"#��-#/! �"#%� �%�"�#�&�����5���1)�#�$)1���"��$�
�Heterogeneous System - 1�%�� ���������3��"��$� 1�� DBMS 1���%#��� /!5+"�"�#����1)�#�$)1���"��$��%���&�� ���0��"�#5�"#��"��$��%�����
Mr.Warawut Khangkhan57 Chapter 5 Database System
����������������������������
�)*��������&!�����#��������'�H�3��"��$��)*����!+��2��#�%#��#3��"��$�
Mr.Warawut KhangkhanChapter 5 Database System58
�)*����!+��2��#�%#��#3��"��$�
����)�������������������)���������������1�%#����)*� 3 �������
� �����1��5������1����� (Conceptual Design)
� �����1������������ (Logical Design)
� �����1���������:' (Physical Design)� �����1���������:' (Physical Design)
Mr.Warawut Khangkhan59 Chapter 5 Database System
� ������������������
(Conceptual Database Design)
� �)*����������#���!+��2��#�%#+���< ��#3��"��$���1�����5������:'���
� 2��#�%#��#3��"��$�/�0 �"�-#�)*�2��#�%#5������1����� ������% >Conceptual Schema”������% >Conceptual Schema”
Mr.Warawut Khangkhan60 Chapter 5 Database System
� ������������������
(Conceptual Database Design)E-R Diagram Class Diagram
Mr.Warawut Khangkhan61 Chapter 5 Database System
� �����������������
(Logical Database Design)
� �)*��������/�0�! Conceptual Schema �1)�#5+"�)*� Logical Schema /�0��$%5��$)1����#3��"��$�/�0�����5�" �-0#����$%5��$)��# Relation (+��)*�3��"��$����#&��'��(�) +����)*� Object (+��)*�3��"��$����#&��'��(�) +����)*� Object (+��)*�3��"��$����#���, )
� ��+�%#��&�"#2��#�%#3��"��$�5������������"�#����)���2��#�%#+������# �'�0�5+"�����&��$�9����-�� &!+���3��"��$����#&��'��(�1�"� ��(���+�-0#5���)���2��#�%#�;��� >Normalization”
Mr.Warawut Khangkhan62 Chapter 5 Database System
� ������������� � �
(Physical Database Model)
� �������������! Logical Schema ��!+��2��#&�"#5��������;��"��$��#5�� )��9������;��"��$� 1����(�����",-#�"��$�
� 2��#�%#/�0 �"������������ ������% “Physical Schema” � 2��#�%#/�0 �"������������ ������% “Physical Schema” /�0&��,�! )&�"#�)*�3��"��$����# �"
Mr.Warawut Khangkhan63 Chapter 5 Database System
NormalizationNormalizationNormalizationNormalizationNormalizationNormalizationNormalizationNormalization� ���, )��&#���'�0��������!�"����#�"��$� 1����)=�+/�0
���������!�������%#< ����"��$�
�Normalization ��� ��������)���)� #2��#&�"#�"��$���#3��"��$�/�0�������!�"��5+"��$%5��$)1��/�0�)*��"��$���#3��"��$�/�0�������!�"��5+"��$%5��$)1��/�0�)*����/��3� (Normal Form) �'�0���)=�+/�0�������� Update 1���������!�"����#�"��$��#
�Normalization ��/��#+�� 6 �$)1�� �"1�% 1NF, 2NF, 3NF, BCNF, 4NF 1�� 5NF (NF –Normal Form) Mr.Warawut Khangkhan64 Chapter 5 Database System
NormalizationNormalizationNormalizationNormalizationNormalizationNormalizationNormalizationNormalization
EmpId EmpName DepNo DeptName Salary CourseNo CourseName DateComplete
2��#�%#�"��$�2��#�%#�"��$� SEmployeeWSEmployeeW �%��/!�%��/! NormalizationNormalizationEmployeeEmployee DepartmentDepartment
Mr.Warawut Khangkhan65 Chapter 5 Database System
EmpId EmpName DepNo Salary CourseNo
EmployeeEmployeeDepNo DeptName
DepartmentDepartment
CourseNo CourseName
CourseCourse
2��#�%#�"��$�2��#�%#�"��$� SEmployeeWSEmployeeW +��#/!+��#/! NormalizationNormalization
EmpId CourseNo DateComplete
Employee_CourseEmployee_Course
��� �!�������������� �!�����������
Mr.Warawut KhangkhanChapter 5 Database System66
��� �!�������������� �!������������ �������!�"����#�"��$� (Minimal Redundancy) �+������0�#������1�"#��#�"��$� (Data Inconsistency Avoidance)
� &��,5�"�"��$��%����� �" (Data Sharing)� &��,5�"�"��$��%����� �" (Data Sharing)� �!+���������)���:��5+"����"��$� �" (Uniform Security Privacy Control)
� ���8���,$��"�#��#�"��$� �" (Integrity Control)�/!5+"�"��$��)*���&����2)�1���/�05�"#��"��$�����(Data Independence)
Mr.Warawut Khangkhan67 Chapter 5 Database System
��������������������������
Mr.Warawut KhangkhanChapter 5 Database System68
��������������������������� &�0#/�0����!�-#,-# ��� >���!+���2�����/!#�(Policy)” /�0���%��5+"&��,������"��$� �"��%#��)��&�/(�:' �"��$���#�#�������)*��"��$�/�0,$��"�# ���0�,�� �" 1�������'�"���%���5�"#���$%�&��
Mr.Warawut KhangkhanChapter 5 Database System69
���0�,�� �" 1�������'�"���%���5�"#���$%�&��
��2���&�&��/4 (Information Policy) ��� ���!+���?��9@�5���1�%#)=� �6�1'�% ���+ ���������� �!1�� 1�������;�&�&��/4
����������������������������� �#���������;� 6$"/�0/!+�"/�0�!+���2���&�&��/4
&%��5+�%���)*�6$"���+�+�����"��#���8�/
� �#�������5+�%���"�#������#�)*�+�"/�01���!+��6$"���6�������%#������1���)*�/#��6$"���6�������%#������1���)*�/#��
Mr.Warawut Khangkhan70 Chapter 5 Database System
���������������������������+�"/�0 1���(�)����� ��! (Data Administration)” ���6�����5����!+���2���1�����������������"��$� ��#���,-#���$1������1��3��"��$�1�������/!'��� ����"��$� ���������������5�"#��"��$���#6$"5�"/ ��� %� ���1��3��"��$�1�������/!'��� ����"��$� ���������������5�"#��"��$���#6$"5�"/ ��� %�
�+�"/�0�����+��"��$�5��#�#������������% 1Data Governance” �-0#������������##�/�0�'�0��-�� ��� �"�#/!5+"�"��$���#�#������� 9:'1�������)���:��
Mr.Warawut Khangkhan71 Chapter 5 Database System
����������������������������#�#�����;���!+��5+"+�"/�0�����+��"��$��)*�+�"/�0
5��� 1(�)���'���� ��! (Database Administration)”
Mr.Warawut Khangkhan72 Chapter 5 Database System
�������*���,!�������,�������$-��������*���,!�������,�������$-�
Mr.Warawut KhangkhanChapter 5 Database System73
����������������(Data Warehouse)(Data Warehouse)(Data Warehouse)(Data Warehouse)(Data Warehouse)(Data Warehouse)(Data Warehouse)(Data Warehouse)
��!���� ��! (Data Warehouse) +��,-# 3��"��$�/�0�����;��"��$�/�0 �"������-#�"��$�(Extract) ��3��"��$���0� �-0#����2��#&�"#1���%#���+�����$%������)C�������1���%#����; �" �'�0����+�����$%������)C�������1���%#����; �" �'�0�)��2����5���������+�1�����&��5����#( ����
� ���#�"��$�����%�)*�1+�%#�"��$����5+�%��#/��#�#����+���( ���� 1�%���#�������"�#����1�%#&%����/!#�����)*�&%���%�� �-����$%���+�"/�0��/!#� ��%� ��1�%#&%������)*���6��� ���#�� ����� ���� ������� �)*��"�
Mr.Warawut Khangkhan74 Chapter 5 Database System
����������������(Data Warehouse)(Data Warehouse)(Data Warehouse)(Data Warehouse)(Data Warehouse)(Data Warehouse)(Data Warehouse)(Data Warehouse)
� 5��#��9��"�#/!&!���"��$�/�0������!�)*��"�#5�"#���#1�%��&%�� ������;� �":�5�&%����/!#��%���"�� �����1+�%#�"��$�/�0�����;��"��$�/�0,$�&!�������% 1��������&- (Data Mart)”���&- (Data Mart)”
� ���#�"��$��"�#&��,�"�+�"��$����#������+��'�0�5+" �"�"��$�/�0���������+��&����)=�+ �"�������-�� �-0#���"�#�4���/������%#+�-0#/�0������% “���* ��� ��!(Data Mining)”
Mr.Warawut Khangkhan75 Chapter 5 Database System
����� ���
�� � ��� � ����
�� �� ��
�� ����
Mr.Warawut KhangkhanChapter 5 Database System76
����� ����� ����
�� ���
�� � ��� �
�� � ��� ���� ����
� ��� !"�#����� (Data Mining)
��#����#������% >���"�'��#������$" (Knowledge Discovery)” �)*��/����/�05�"5����"�+�"��$����#������+�����&$#
� 5�"���������"��$�/�0�!�����5�3��"��$� )����� )� 5�"���������"��$�/�0�!�����5�3��"��$� )����� )�"�����"�+ 1��1���� %��"��$� 1���������E��"��$�/�0��� 9�%
� ���, )��&#��+��� �'�0�5�"�(����"��$�5�����1������9��"��$�5�����
� &� ) �;��� ��/!�+���#�"��$� �;��� ���!�"��$�5������������+��'�0�5+"�"�'��"��$�+����"��/;����#5+�%Mr.Warawut Khangkhan77 Chapter 5 Database System
���������#).����������#).�(Web Database)(Web Database)(Web Database)(Web Database)(Web Database)(Web Database)(Web Database)(Web Database)
� '���� ��!(��#�( ��� ��&�"#��;��'�/�06$"5�"&��,������$5�&�0#/�0�"�#�� �"
� 5�� ��%����;��'������&��,�'��#1&�#6��"��$� 6$"5�"/! �"�'��#�)*�������"��$��/%���� �������;��'����89����/! �"�'��#�)*�������"��$��/%���� �������;��'����89�����% “Static Web” 1�%���0������!3��"��$��)��� ��������&�"#��;��'� /!5+"��;��'������&��,�'�0����-���)*���%#�� ��%� 6$"5�"&��,)E���"����1&�#�������+;� �"����;��'� �" �)*��"� �������;��'����89�����% “Dynamic Web”
Mr.Warawut Khangkhan78 Chapter 5 Database System
���������#).����������#).�(Web Database)(Web Database)(Web Database)(Web Database)(Web Database)(Web Database)(Web Database)(Web Database)
��!������ �'���� ��!(��#�( ��� ��&�"#3��"��$� �"/�0����0�#�����������/�05+"�������;� ��� ������&�"# ���&���)�� (Script) �'�0�)�����6��"��$�5�3��"��$���;� �"/�0����0�#�������������%���� ���0�������0�# ��������"�#�� �"/�0����0�#�������������%���� ���0�������0�# ��������"�#���"��$� ����0�#��������������!�%�"��$�/�0 �"����� ��������)�����6��%����� ���&���)�� 1�"��!��������",-#�"��$�5�3��"��$����!�"�#�� ������&%#6���'(����� )1&�#6�/�0����0�# �������
Mr.Warawut Khangkhan79 Chapter 5 Database System
���������#).����������#).�(Web Database)(Web Database)(Web Database)(Web Database)(Web Database)(Web Database)(Web Database)(Web Database)
1. � ����� ���!����"�# �������"��$�
Mr.Warawut Khangkhan80 Chapter 5 Database System
Server IBM CompatibleServer IBM CompatibleServer IBM CompatibleServer IBM Compatible Client IBM CompatibleClient IBM CompatibleClient IBM CompatibleClient IBM Compatible
2. ��"��� � 7��� � �����89�� :������"��$�# �; �����3. ��"��� � 7��� = >����?� �� ASP 9�>9=�� ����$B �= "����C� D� = HTML
4. ��"��� � 7��� C:����C� HTML # �;!� � ����� = >����!=���!����"�#