Presentasi sedang didownload. Silahkan tunggu

Presentasi sedang didownload. Silahkan tunggu

1 Analisis dan Perancangan Perangkat Lunak PEMODELAN DATA.

Presentasi serupa


Presentasi berjudul: "1 Analisis dan Perancangan Perangkat Lunak PEMODELAN DATA."— Transcript presentasi:

1

2 1 Analisis dan Perancangan Perangkat Lunak PEMODELAN DATA

3 2 Konsep Pemodelan Data

4 3 1. PEMODELAN DATA DENGAN E/R DIAGRAM The data model also describes the relationship among data and any constraints that have to be defined on the data. The data model also describes the relationship among data and any constraints that have to be defined on the data. Data models can broadly be classified into two categories: Data models can broadly be classified into two categories: Object-based logical model – focuses on describing the data, the relationship among the data, and any constraints defined. Object-based logical model – focuses on describing the data, the relationship among the data, and any constraints defined. Record-based logical model – focuses on describing the data structure and the access techniques in a Database Management System. Record-based logical model – focuses on describing the data structure and the access techniques in a Database Management System. A data model is a description of the organization of data in a database. A data model is a description of the organization of data in a database.

5 4 Entity-Relationship Model There are various object-based models. The most widely used is the entity-relationship model (E/R model). The entity-relationship model is based on a real- world perception that comprises a collection of objects or entities and the relationships among these. The diagram used to represent an E/R model is called an E/R diagram. The components of an E/R diagram are: Entities Relationships Attributes

6 5 Entities An entity is any object, place, person, or activity about which data is recorded. Entities are named and represented inside a box. There are two types of entities: Dependent Independent Dependent entities are also called weak entities, and independent entities are called regular entities. Weak entities are represented by double-lined boxes.

7 6 Relationships A relationship is an association among entities. A relationship is depicted as a diamond with the name of the relationship type. A relationship can associate an entity with itself. Multiple relationships can also exist between the same entities. There are three types of relationships: One-to-One One-to-Many Many-to-Many

8 7 Attributes An attribute is a property of a given entity. Attributes are depicted as ellipses, labeled with the name of the property. The key properties are underlined. A relationship can also have attributes.

9 8 One-to-One Relationship

10 9 One-to-Many Relationship

11 10 Many-to-Many Relationship

12 11 Weak entity A weak entity is an entity whose existence depends on some otherentity. A weak entity is an entity whose existence depends on some otherentity.

13 12 Subtypes and Supertypes A subtype is a subset of another entity. A subtype is always dependent on the supertype for its existence. Each entity type (subtype or supertype) maps to a separate table. The primary key of the supertype is the foreign key of the subtype. It creates a link between the two. The foreign key of the subtype is also its primary key.

14 13 Subtypes and Supertypes

15 14 Each entity type (subtype or supertype) maps to a separate table.

16 15 If there are any entities with common attributes, merge the entities.

17 16 Attributes may Become Entities

18 17 Specialization

19 18 Generalization

20 19 The previous E/R diagram can be converted using aggregation

21 20 The previous E/R diagram can be converted using aggregation

22 21 2. Normalisasi dan Denormalisasi Data

23 22 Dua Pendekatan dalam mendesain Database Relasional Pendekatan Top – Down : menggunakan E/R Diagram Pendekatan Top – Down : menggunakan E/R Diagram Pendekatan Bottom – Up : menggunakan proses Normalisasi dan denormalisasi Pendekatan Bottom – Up : menggunakan proses Normalisasi dan denormalisasi

24 23 Normalisasi dilakukan langkah-demi langkah, sehingga dari record data yang kompleks dapat diubah menjadi record data yang simple. Normalisasi dilakukan langkah-demi langkah, sehingga dari record data yang kompleks dapat diubah menjadi record data yang simple. Pengulangan-pengulangan data direduksi tanpa menghilangkan informasi yang diinginkan. Pengulangan-pengulangan data direduksi tanpa menghilangkan informasi yang diinginkan.

25 24 Contoh tabel tanpa proses normalisasi Pada tabel tersebut, Student ID, Student Name muncul lebih dari sekali dengan nilai yang sama. Namun demikian ada antribut lain yang ikut diulang : StudentAddress, StudentBirthdate, StudentCity, StudentZip, yang merupakan pengulangan data yang tidak perlu.

26 25 Keuntungan dari proses Normalisasi Dengan mereduksi pengulangan data, maka akan mempercepat proses pengurutan dan pencarian data. Dengan mereduksi pengulangan data, maka akan mempercepat proses pengurutan dan pencarian data. Data dengan nilai Null menjadi lebih minimal sehingga meminimalkan ketidakkonsistenan data Data dengan nilai Null menjadi lebih minimal sehingga meminimalkan ketidakkonsistenan data Dengan normalisasi, database menjadi lebih compact Dengan normalisasi, database menjadi lebih compact

27 26 Normalisasi tahap I Setiap sell dari tabel harus memiliki satu nilai data yang presisi. Setiap sell dari tabel harus memiliki satu nilai data yang presisi. Pada berikut kolom Hours berisi data lebih dari satu Pada berikut kolom Hours berisi data lebih dari satu

28 27 Normalisasi tahap I Hasil normalisasi tahap I diperoleh tabel dengan setiap sell hanya berisi satu nilai, walaupun akhirnya terdapat pengulangan data pada kolom tertentu Hasil normalisasi tahap I diperoleh tabel dengan setiap sell hanya berisi satu nilai, walaupun akhirnya terdapat pengulangan data pada kolom tertentu

29 28 Normalisasi tahap II Tahap kedua normalisasi dilakukan jika didapatkan beberapa atribut berulang, sehingga memungkinkan beberapa atribut tadi dipecah pada tabel berbeda Tahap kedua normalisasi dilakukan jika didapatkan beberapa atribut berulang, sehingga memungkinkan beberapa atribut tadi dipecah pada tabel berbeda

30 29 Normalisasi tahap II Dari normalisasi tahap II diperoleh dua buah tabel yaitu tabel EmployeeDept dan tabel Project Dari normalisasi tahap II diperoleh dua buah tabel yaitu tabel EmployeeDept dan tabel Project

31 30 Normalisasi tahap III Normalisasi tahap ini dilakukan jika terdapat beberapa atribut (bukan atribut kunci) pada suatu tabel dan muncul berulang –ulang, sehingga memungkinkan untuk dipecah pada tabel berbeda. Normalisasi tahap ini dilakukan jika terdapat beberapa atribut (bukan atribut kunci) pada suatu tabel dan muncul berulang –ulang, sehingga memungkinkan untuk dipecah pada tabel berbeda.

32 31 Normalisasi tahap III Atribut Dept dan DeptHead masuk tabel baru dengan nama Departement Atribut Dept dan DeptHead masuk tabel baru dengan nama Departement

33 32 Boyce-Codd Normal Form Jika pada suatu tabel terdapat lebih dari satu atribut yang memungkinkan berfungsi sebagai kata kunci (overlapping candidate keys), maka candidate keys dapat dipecah pada tabel yang berbeda Jika pada suatu tabel terdapat lebih dari satu atribut yang memungkinkan berfungsi sebagai kata kunci (overlapping candidate keys), maka candidate keys dapat dipecah pada tabel yang berbeda

34 33 Fourth Normal Form If a relation has many-to-many relationships with two or more relations, then the attributes of all the three or more relations cannot be depicted in the same relation. When you model such situations in a relational database, you will either have redundant data or use null values. A condition that requires duplication of values and thus enforces mutual independence of multivalued attributes is called multivalued dependency.

35 34 Fourth Normal Form (Contd..) You can use fourth normal form (4 NF) to remove multivalued dependencies. A table is in 4 NF if it is in 3 NF and has no multivalued dependencies. To apply 4 NF, you need to put all multivalued attributes in individual tables containing the key to which the attribute values apply.

36 35 Fourth Normal Form

37 36 Fourth Normal Form Hasil Normalisasi ke 4

38 37 Other Normal Forms Some constraints like business rules result in the need for fifth normal form (5 NF). For a table to be in 5 NF, it has to be in 4 NF and should abide by some business rules. The purpose of 5 NF is to have tables that cannot be further decomposed. If the business rule does not exist, then there is no need of 5 NF. In addition to 5 NF, there is another normal form called the domain-key normal form (DKNF). A table is in DKNF if every constraint on the table is a result of the definitions of domains and keys.

39 38 Other Normal Forms Pada tabel berikut untuk departement Computer Science terdapat 3 kode subject yang berbeda : CS150, CS103 dan CS104 yang masing masing diambil oleh 3 student yang berbeda. Pada tabel berikut untuk departement Computer Science terdapat 3 kode subject yang berbeda : CS150, CS103 dan CS104 yang masing masing diambil oleh 3 student yang berbeda. Oleh karena itu departemen ini merupakan domain sehingga kita bisa memecah tabel baru kolaborasi antara atribut Departement dengan Subject, Departement dengan Student atau Subject dengan Student Oleh karena itu departemen ini merupakan domain sehingga kita bisa memecah tabel baru kolaborasi antara atribut Departement dengan Subject, Departement dengan Student atau Subject dengan Student

40 39 Other Normal Forms Diperoleh 3 tabel Dept – Stud Dept – Sub Sub - Stud


Download ppt "1 Analisis dan Perancangan Perangkat Lunak PEMODELAN DATA."

Presentasi serupa


Iklan oleh Google