The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.

[UNOFFICIAL] BUKU TEKS SAINS KOMPUTER TINGKATAN 4 DALAM BAHASA INGGERIS (AUTO-TRANSLATE)

Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by Tunku Irfan, 2023-08-18 17:24:27

[BAHASA INGGERIS] BUKU TEKS SAINS KOMPUTER TINGKATAN 4

[UNOFFICIAL] BUKU TEKS SAINS KOMPUTER TINGKATAN 4 DALAM BAHASA INGGERIS (AUTO-TRANSLATE)

Keywords: sains komputer,buku teks sains komputer,sains komputer buku teks,buku teks sains komputer tingkatan 4,sains komputer tingkatan 4

Computer Science Form 4 Exit the system Reset text box1 Instructions Program Code Iterates the integer i from 0 to 10 192 (a) State and explain the characteristics of the phases in the SDLC using a bubble map. to display the output as below. The program must be able to display the table title "ZERO TABLE" and be able to count from digit 1 to digit 9. 6 Different types of system development life cycle models are available to ensure that a project is implemented successfully. Using the i-Think map, answer the questions below. 4 Produce a program that can display multiplication tables or Tables of Numbers. Use JOptionPane 3 Give the program code to execute the following command: The interface has been prepared with control names as shown in the following figure. Data for the input of the quantity of goods and the price of goods can be changed and can be entered from the keyboard. by using a tree map. (c) Explain the important features in the phases of the waterfall model using a flow map. 5 Al Rahmat is a grocery store in Taman Iskandar. To simplify the calculation for grocery items, the owner of the store, Mr. Rahmat, asks you to help him build a software to calculate the total retail price. (b) Choose two SDLC models that you know, explain the advantages and disadvantages of each Machine Translated by Google


DATABASE Think... CHAPTER 2 CHAPTER 2 DATA BASE One of the success factors of IT giants such as Google, Amazon and Facebook is the ability of the technology platform to accommodate a very large and constantly growing amount of data. The main challenge for this company is to accommodate all that data and maintain search performance and data management. If data is likened to a word, the process of storing and searching for a word in a small notebook is not difficult. Now, try to imagine when that book is kept in your school library. Can you find the words in a short time? » Development of a relational database » Database system development In this chapter, you will learn: » Relational database design » Contact database 193 time? • What are examples of using databases in our daily lives? • How is database technology managed so that the quality of use of computer systems gives satisfaction to users? • How many users can access the database at once • How are databases designed? Machine Translated by Google


Relational Database Concepts of Relational Databases Table 2.1 Definition of data and information and examples Process Save 2.1.3 Identify entities, attributes, relationship sets and cardinalities (one-toone, one-to-many and many-to-many) based on requirements Quote 2.1.2 Differentiate database models: hierarchical, network, relational , object oriented Data Computer Science Form 4 2.1.1 Explain the importance of data integrity, data consistency and data redundancy Data Figure 2.1 Relationship between data and information Figure: Data storage in a computer system. users Information goo.gl/p1MMVM CONTENTS LEARNING STANDARDS STANDARD Average monthly test score for History subject for Class 4 Dynamics. • Data is a collection of raw facts about a thing, event, person or entity that can consist of words, numbers or pictures. become more meaningful and easy for someone to understand. meaningful or meaningless until the facts are processed. • Data can be a fact that Information • Information is the result of the collection, processing and analysis of data that can be used to make a decision. Monthly test scores for Definition • The information produced will History subject for every student in class 4 Dynamics. Data Example 194 Data is the computer's resource for making plans and decisions. The amount of data that needs to be processed by the computer is huge. Furthermore, this data needs to be shared efficiently and securely. The handling of large amounts of data is very challenging because the stored data may contain errors, be repeated or not completely updated. This processed data will be useful information to users. Table 2.1 explains the definition of data and information while Figure 2.1 shows the concept of data and information relationships. 2.1 Machine Translated by Google


Processing Base Manual Data System Processing System System File you ? Did you know? Figure 2.3 File processing system User update data. Figure 2.2 Evolution of data management File and difficult to File system Storage using files has many disadvantages such as it is difficult to reach the required data in a short time, many identical copies, Operating system goo.gl/pMrvk5 stored in memory and can be lost when the power supply is disconnected. Therefore, the data needs to be stored as a file in the hard disk and can be accessed when needed. Management System CHAPTER 2 DATA BASE Data entered into the computer DBMS-Database 195 1 Manual Processing does not involve the use of a computer. The main disadvantage of File Processing Systems is difficulty To ensure the integrity of the stored data, the data must be stored in the computer systematically so that it can be easily accessed when needed. Just imagine, without digital storage, the amount of paper documents needed to keep records might fill a cabinet until a room is full. At this stage, human power is required to handle the data. The processed data is entered into files and cabinets according to certain rules. The disadvantages of manual processing are that a lot of labor is required, a large space for processing and storage and relatively slow search when the data is increasing. 2 File Processing System uses computer technology that stores documents in the form of digital files. This allows previously manual activities to be processed automatically using operating systems and computer applications. Before the concept of a database was introduced, data in computerized systems was stored using a common file system. Common file systems have many disadvantages for managing large and complex amounts of data. To make data management more efficient and effective, computer technology is used to facilitate the process of data storage, production and updating. This triggered the evolution of data processing systems, see Figure 2.2. Machine Translated by Google


Did you know? you ? 196 • Have a query language Database Management System Various users • Have data consistency Database • Less overlap • Isolation of data and applications Computer Science Form 4 • Tables based on relationships goo.gl/J02rGW • Contains real world entities Figure 2.5 Block diagram of a computer system Entity relationship diagram (ERD) construction tutorial A modern Database System contains the following features: • Various displays Savings Process Output • Security Figure 2.4 Database System Input 3 Database systems are more sophisticated than file processing systems because they can store large amounts of data in a much smaller storage space. A database system is a software system that manages databases. A database is a collection of logically related data whose structure allows its contents to be easily retrieved, managed and updated. There are several types of database models that are commonly used. A database model is a conceptual arrangement of a database and is a way of defining and using data in a database. See Figure 2.5. Database (PD) stores data with its structure once. Because of this, most organizations, whether small or large, use databases to store, manipulate and access data across most organizations. Consciously or not, a lot of individual information and activities are stored in databases in companies and government organizations. detect copies of the same data in different files and the data is slow to update. Computer memory space can be used minimally even though the stored data is very large and numerous. Machine Translated by Google


2.1.1 Importance of Data Integrity, Data Consistency and Data Redundancy Did you know? you ? 197 Top Ten Enterprise for Database System The Malaysian Ministry of Education also developed a database to make it easier for teachers to enter all student information in the database. CHAPTER 2 DATA BASE Pupil attendance is also entered through this database system, and makes it easier for teachers to know pupils who have problems not attending school. In fact, various forms related to teachers and students can also be downloaded through this database system. goo.gl/VCJaV3 Examples of aspects of life that involve database storage: 1 Standard format allows data to be stored and retrieved from any hardware and information system. • Every citizen's information is stored in a government database. 2 Data stored in the database can be reused by different users through different systems for different purposes. For example, citizen data in the Registration Department's database can be reused when citizens apply for a passport or renew a driver's license. Generally, a database is specialized to store data while the interpretation of data as information is completed by computer systems connected to the database. • When purchasing a flight ticket, passenger and flight information is stored in the PD. • The University has a database to store lecturer, course and student data. 3 Data storage in the database is efficient because the format and structure of relational data are specialized for systematic storage and fast and flexible access. Another factor is that the server computer hardware that supports the database operation, has high specifications for access to the database. Good data is needed to produce accurate and meaningful information. The characteristics of the data stored in the database must achieve the following qualities: • Employees at the supermarket scan each item sold to arrive at the price of the item from the database. • Data consistency A database is not just a collection of data. A database is a collection of data stored in a standard format (standard) and specifically designed to be able to share data with many users efficiently. • Data integrity • Data redundancy Machine Translated by Google


198 If a pupil is registered with the pupil registration number, 123/16, the database should not allow the registration of another pupil with the same registration number (123/16). This guarantees that each record is unique by adhering to integrity rules. 1 Entity integrity: Tables have at least one unique data attribute for each record. Example: Student number must be unique. 3 Domain integrity: The data attributes in the table must be correct based on a problem domain. • Why is data integrity necessary? 2 Referential integrity: Records in two different tables can be linked by sharing the same data attributes. If there is no relationship between the records, the attribute is left blank. • Data integrity means completeness, accuracy and validity of data (validation) and refers to the accuracy of valid data through the entire data life cycle. 1 Data with poor integrity may be corrupted or lost. Corrupt data is data that has been (unintentionally) changed from its original value. • To ensure data integrity, input must not only be accurate but 2 Data integrity aims to prevent accidental changes to information. Therefore, data integrity is important to ensure that there are no errors in data entry. If there is a relationship between the two records, the attributes in both tables share the same data value. comply with the rules that have been set. Example 1 Based on Example 1, build a table that has the registration number of the Overseer Leadership Camp participants and the names of the participants. Check your schedule and make sure the integrity of your data is guaranteed. 124/16 Name Yep Ling Tzi 123/16 Fatihah bt Roslan 123/16 Number Examples of non-compliant data integrity situations Adam bin Ali Mind Test Registration Computer Science Form 4 Data Integrity ( Data ) integrity Machine Translated by Google


000213-03-5675 Suraj A/L Ramu Alia bt Roslan 000405-11-5434 Student IC Ah Chong 03-61402997 03-69104356 Alia bt Roslan goo.gl/zchUUw 03-43543456 goo.gl/Pw1FzQ Students name 03-61402987 Structuring Data for Strong Consistency 03-77876789 Redundant 000405-11-5434 001121-14-2312 No. Telephone 000405-11-5434 Alia bt Roslan CHAPTER 2 DATA BASE 000607-14-4343 Tan Mei Ling 03-61403997 Figure 2.6 Redundancy of data in the file system Example 2 Because Tan only updated his customer's phone number in a book, the phone number data lost its consistency. Tan recorded the phone numbers of his customers in two separate books, a diary and a notebook. If the customer's phone number changes, Tan needs to update the number on both books he uses. What happens if Tan only updates the customer's phone number that changes in only one book? Solution: • To ensure data consistency, the process of updating copies of data in all storage locations must be done meticulously. Example: • Data redundancy refers to the duplication of data resulting from repeated copies of data but in different locations. 1 To ensure that the data obtained is reliable and not • Importance of data consistency: questioned. Figure 2.6 shows student records in the Student Information System. Try looking at the pink line. Student identification card and student name are the same but No. different phones exist three times in the file system. This situation is called data redundancy. • Consistency refers to the consistency or uniformity of data that will 2 To ensure that no data consistency issues arise if the same data is repeated in several storage locations. affect the reliability of the data. 199 Data ) Data ) Data Consistency Redundancy ( Redundancy Data Consistency ( Machine Translated by Google


Teamwork Part 1 Steps: Tools needed: Three pieces of paper, pencil, eraser. 1 Take a new piece of paper and draw each of the following tables: Do this activity together in class. How to plan and manage data center redundancy? Level name The name of the grade teacher 33 Data integrity, data consistency and data redundancy goo.gl/fXrMBU Computer Science Form 4 Student registration number Students name 200 1 avoid unnecessary database size increase. 4 prevent the data from becoming corrupt i.e. it cannot be used again. (Duplication of the same data over and over again). 1 Redundancy uses excess computer storage resources and therefore data redundancy needs to be minimized. comprehensive. 2 Redundant data updates take a lot of time and may not 3 Causes data to become corrupt. 2 avoid inconsistent data. Among the purposes of avoiding data redundancy is to, 3 avoid data becoming inefficient. 4 Making the database less efficient. What happens if this data redundancy is not overcome? Machine Translated by Google


Student registration number Level name The name of the grade teacher Students name CHAPTER 2 DATA BASE Level name 201 (a) How are the data allocated to the two tables re-linked? Is this integrity, redundancy or consistency? 5 Discuss in terms of data integrity, redundancy and consistency. 4 Check your schedule. Part 2 3 Discuss the following questions: 3 Find five friends in the class and ask for details to fill in the table. (e) Suppose the name of the level is written as 4 Science, Four science, or put 4 science in different lines. Is this a problem of integrity, redundancy or consistency? 2 Copy the data into the new tables. any possibility of compromised data consistency? 2 Make sure you have enough blank lines. (d) Suppose the grade teacher has been replaced. How often should updates be made? Is there (c) Is there a possibility that two or more students have the same level name and the same level teacher? the same? (c) Suppose the name of the form teacher has been changed. What do you need to do to update this information? Does the new table design help reduce data consistency? Can this delay be reduced further? (b) Is there a possibility that two students have student registration numbers that 1 Use two new pieces of paper. Draw the following table: (b) Compared to the use of the previous schedule design, has the redundancy been reduced? (a) Are there repeated data? Repeat the above activity using the new table design. Machine Translated by Google


you ? Did you know? There are four database models with their respective advantages: hierarchical, network, relational and object oriented. The relational database model is the most popular model to refer to as an example of a database. A database system uses a specific database model as its structure. There are several types of database models that are commonly used. A database model is a conceptual arrangement of a database and is a way of defining and using data in a database. See Figure 2.7 below. 2.1.2 Database models Literature Computer Science Form 4 Science Figure 2.8 An example of a hierarchical database model Academic stream Accounting trade about our identity card can be used again when we want to apply for a passport or driver's license! Figure 2.7 Database models Biology Guiding Science This means data Chemistry Data in the database of the National Registration Department can also be accessed and reached by the Immigration Department and the Road Transport Department. Physics Hierarchical Database Model 202 Relationship Database Hierarchy Object oriented Network (Relational) (object oriented) Model Machine Translated by Google


SMK Adela Database systems have evolved since their inception. You can read the article on this website to find out more. Computer School Name Class Science Innovation School Data attribute/field goo.gl/F0c97d Name Figure 2.9 Hierarchical Database Model CHAPTER 2 DATA BASE Subject Student Figure 2.10 Entities of a hierarchical database model Teacher 203 The student entity is the parent of the subject entity. The subject entity is the child Suppose a database based on a hierarchical database model is required to store data records of entities such as School, Class, Pupil, Teacher and Subject. First of all, define the relationship between the entities through a hierarchical model, see Figure 2.9. to the student entity and does not become the parent of any entity. The hierarchical database model is the earliest model since 1950 and is often used in information management systems produced by IBM companies. In a hierarchical database model, data is organized in a tree structure as shown in Figure 2.8. This model is suitable for use if an entity has a parent relationship with one or more child entities. This model does not support the relationship of many parent entities to many child entities. Maybe because of that, this model is not used much. A hierarchical model provides a structure to encode data records for each entity. Note that the school entity is the parent of the class entity while the class entity is the child of the school entity. On the other hand, the class entity is the parent of the teacher entity and the student entity respectively. Example: Data records for each entity (School, Class, Pupil, Teacher and Subject) are coded in a hierarchical organization, see Figure 2.10. Each entity is represented by a grid with two sections in the top row and in the bottom row. The upper part shows the name of the attribute while the lower part shows the data for that attribute. Machine Translated by Google


School records Mind Test 04 May 2000 Teacher record 1144 Subject Izati bt Ahmad Subject code # School Name Class record PJ Lim Chai Hoon 10 August 1986 Computer Science Form 4 Class 123/16 Izati bt Ahmad 04 May 2000 Class Name Address Pure science Figure 2.11 Entity with several attributes Extras, Biology, Chemistry, History? This is not a problem because the relational model can be generated Student ID # Class Address Name Physics Based on Figure 2.12, think for a moment. Date of birth SMK Adela Student records Teacher ID # FZ1 Name Address easily in hierarchical capital. Try to draw it. 4 Smart Date of birth PJ Subject record Figure 2.12 Data records in a hierarchical model 4 Devotion Student ID # Date of birth 123/16 PJ 4 Trust Flow Isn't Izati able to take one or more subjects such as Modern Mathematics, Mathematics 204 Use the arrows to link the data records according to the order of entities like the structure in Figure 2.11. Arrows are drawn from one data record to another data record. Arrows point to primary key attributes in each data record (primary key attributes are marked #). See Figure 2.12. In figure 2.12, the SMK Adela school entity has three class entity records which are 4 Trust, 4 Bakti and 4 Cerdas. Class 4 Amanah has student data records with ID 123/16 and also teacher records with ID 1144. Pupil 123/16 took the subject entity with subject code FZ1. An entity can have one or more attributes. In the example given, the school entity has only one attribute, school name. In an entity with several attributes, select a unique attribute as a reference (called a primary key). For example, the student ID is selected as the primary key for the student entity. Use the hash symbol # as the primary key identifier. For other entities such as students, there are several other attributes such as student ID, name, date of birth and address. Machine Translated by Google


A search for all Subjects in a given Class can be made directly as opposed to a hierarchical model. The Student and Subject relationship is a many-to-many relationship , i.e. each student may register for many Subjects and each Subject has many Students. Example: This weakness is overcome through the network model. The Subject entity can have two 'parents' which are the Class and Student entities. A network database model consists of several types of records and is linked through pointers. This model can overcome some of the indeterminacy in the hierarchical model. Back to the example from the hierarchical model. Can a subject like Physics be taken by students other than Izati? Of course yes. However, can the relationship be shown in a hierarchical model? you ? Did you know? 205 Class Registration Subject Teacher Database Models Mind Test One of the figures who won the Turing Award for technological inventions is Edgard Frank Codd. While working with International Business Machine (IBM) New York, he came up with an idea relational database in the 1960s. The model has become a very popular model in modern database design. An entrepreneur builds database technology based on Codd's ideas. The entrepreneur, Larry Ellison, has successfully created the popular database, Oracle with a startup cost of USD2000. goo.gl/nquXWs You are given the task to build a network database model similar to the example shown next but change the Pupil Entity to have two parents which are gender and subject entities. Student CHAPTER 2 DATA BASE School Figure 2.13 Network database model Network Database Model Machine Translated by Google


Relationship Model (Relational ) 206 Example: This model is often used because it is easy to build, use and manage in the real world. The data is organized in a table consisting of columns and rows. An advantage of the relational database model is that the database structure does not need to be specified in advance. Look at Figure 2.15 for a clearer picture. This model is illustrated by using three entities (tables) namely STUDENT, REGISTRATION and SUBJECT. The student ID attribute of the STUDENT entity and The subject code from the SUBJECT entity is used as the primary key. This primary key will be linked to the foreign key of the student ID and Subject Code attributes in the REGISTRATION entity. After linking through this primary key and foreign key, the respective data will be combined. Teacher record Izati bt Ahmad 04 May 2000 Class 124/16 Mathematics Flow Student ID # 27 Apr2000 Class Name 1144 student ID# 124/16 MT1 PJ 123/16 Date of birth Lim Chai Hoon 10 August 1986 FZ1 Class record School Name Subject code # MT1 Physics FZ1 Additional School records Nicole Devi Student records PJ Pure science Figure 2.14 Network database model data record Relational database goo.gl/UVlRnO 123/16 Address 123/16 4 Trust Registration record Pure science 124/16 FZ1 4 Devotion Teacher ID # Damansara Subject record Computer Science Form 4 Name Date of birth Subject code 4 Smart Subject Class Address MT1 SMK Adela Machine Translated by Google


) Object Oriented Database Model ( Object-oriented 207 Each instance of a class has its own data value for each attribute but can still share the same attribute names and methods with other instances of the class. (a) Class (class) – describes the state of the actual object entity Object-oriented models are a new method in data management. This model stores the definition of objects that can be reused by software. This model stores objects and relationships. This model has the same characteristics as the network model which is able to represent data for many-to-many relationships. Figure 2.16 illustrates the concept of object orientation for the Lecturer class which has its own attributes and methods. (b) Attributes (attributes) – data representing the properties of the object Example: Objects in a class are known as class instances. (c) Method (method) – explains the behavior of an object and is also known as a procedure or function. FZ1 Flow Science Name Faculty = FSTM Telephone No KIM Literature Student ID Figure 2.15 An example of a relational database model Izati bt Ahmad 123/16 Attributes UpdateProfile() 5A Build an object-oriented database model that uses the teacher as a class and fill it with the appropriate attributes for that class. 124/16 Name = Ahmad Naseer No. Phone = 0123457891 123/16 SUBJECT No. Phone = 0129876543 Faculty = Foundation Center Staff_No Lecturer Staff_No = 0500 FZ1 Pure science 128/16 Gender Method ShowCode() GetResearchCode() CHAPTER 2 DATA BASE Student Class Mind Test SC1 Class events Gender = Female Staff_No = 0421 Name REGISTRATION Student ID 5B Figure 2.16 Class representation of an object-oriented database model Faculty Chong Wei Gender = Male Subject code Physics Class definition Name = Siti Alia Mansor Subject Code Subject Machine Translated by Google


C Database • The simple concept of using a tree structure to organize records. E G • To overcome the disadvantages of the hierarchical database model. • Not suitable for many parent to many child relationships. B i F i • Easy to build, use and manage. • Difficult to add new contacts. K K C Relational Database B • Data is arranged in a table consisting of columns and rows. D Network G F • For many parent to many child relationships. J • The earliest model. • This model is the most frequently used among other models. H • For one parent to many child relationship. H A J D L A Hierarchy E (Relational) Computer Science Form 4 10-2 Block C B Model B+ 134 Block Palma-2 Uncle Description Address A Table 2.2 Comparison between database models 10555 10555 Adam Alan 10337 10337 Name 10555 10359 10359 id id 10337 10359 Grade 227 Prime Condo id 208 Machine Translated by Google


you ? 2.1.3 Entities, Attributes, Did you know? Relationship Sets and Cardinalities in Databases CHAPTER 2 DATA BASE (b) This class cannot be declared final. The entity class must meet the following requirements: Table 2.3 Examples of common environments using databases (c) An entity may extend both entities. (a) The class must be protected. A database is needed to store data from the environment to process the information system. To represent the environment, the database contains components consisting of entities, attributes, relationship sets and cardinalities in its design. Databases are developed for information systems that are in various environments. See Table 2.3. The environment is the organization in which the database is designed, developed and deployed. 209 • New methods in data management. Object Book database system and reading collection (object-oriented) Object Course registration database system by students Object Object Oriented Student information database system Object Database Supermarket Object Public Library Object Universities and colleges • Has the best search performance among other models. Product database system • For databases that require complex relationships between objects. Object Object • This model stores object class definitions and relationships. Sales database system Loan database system Environment Database system Machine Translated by Google


My Malaysia Computer Science Form 4 In June 2001, PenDrive, the first flash drive was introduced to the world. Pua Khein Seing who comes from Sekinchan, Selangor is one of five friends who created the world's first flash drive. Currently, he is the president of Phison Electronics Corp, a company that was founded in Taiwan. Figure 2.17 Components in the database. Figure 2.18 Entity symbol Entity Example 3 210 An entity refers to a unique and identifiable object in an environment such as a person, place or thing. Entities have descriptive data that can be collected and stored. Not all objects are suitable as entities. If no data can be associated or there is no need to store data about an object, then the object is not suitable as an entity. In a database, each table represents an entity while each record represents an instance of an entity. Database design is required to produce one or more relational tables. Each relational table represents one type of entity. Each relational table contains one or more records. When designing an entity on paper, use a rectangle symbol and write the name of the entity. Entity names should be proper common nouns. Proper nouns should not be used. This symbol will be studied in depth in subtopic 2.2. Database design using connected diagrams. Each record is an instance of an entity and contains a set of attribute values. Notice that every record in the same table has the same attribute types. The following content will explain more about the components of this database. Brenda 92 Name 80 Score Database 10555 Attributes Relationship/entity table 10337 10359 Record id Interest Attribute value 90 Izzati List the entities for the database in the school environment. Solution: Entities that can be used include teachers, students and subjects. Machine Translated by Google


Name date of birth. Attributes are of several types. Among them are, identification card_number Composite attributes are attributes created by combining simple attributes. For example, a student's name consisting of first_name and last_name. ENTITY ATTRIBUTES Composite attributes An attribute that has multiple values. For example, a person can have more than one phone number. CHAPTER 2 DATA BASE Figure 2.19 Attribute symbols An attribute that has only a small value and cannot be further divided. For example, student identification card numbers have 12 digits and cannot be changed. Multiple value attribute identification. Simple attributes For example, the age that can be published through Class Derived attributes are attributes that do not physically exist in the database but whose values are derived from other attributes in the database. For example, number_card_ Figure 2.20 Relationship between entities and attributes An attribute that has a single value. Derived attributes Address Single value attribute Date of birth Student Did you know? you ? Example 4 Given student names such as Arumugam, Boh Leng, Che Siti and Iking. Draw the appropriate entity symbol. Solution: When designing an attribute on paper, write the attribute name in an oval circle symbol. Then, draw a straight line connecting the attribute symbol with the associated entity symbol. Entities have descriptive data. These descriptive data are called attributes in the database. Attributes are important because they describe the characteristics of an entity. In a database, attributes are columns in a table with the column name as the attribute name. For each record, attribute values can be filled in below each column. 211 Attributes Machine Translated by Google


A relationship involves two entities. The first entity is the subject entity, which is the actor who performs the relationship on the second entity. The second entity receives the effects of the relationship, and is therefore called an object entity. A relationship is an association between entities. Relationships refer to actions and are represented by verbs. Compare the meaning of relationship with entity. <subject entity> <relationship> <object entity> A relationship set is a collection of pairs of subject-object entities that have the same relationship. A relation set uses the following syntax. Entities refer to objects and are represented by common nouns. The syntax of a connected diagram is as follows: To understand this concept more deeply, study the following examples. (c) Draw a suitable relationship diagram. • Ai Ling studied Geography. • Adam studied Computer Science. (b) Study (c) • Anastasia studied History. Solution: (a) Identify the entities in the relationships above. (a) Adam, Ai Ling and Anastasia are events or objects for the Student entity. Computer Science, Geography and History are events or objects for Subject entities. (b) State the appropriate relationship name. Given the following relationships. Example 5 Subject entity Figure 2.21 A relationship set showing the relationship between two entities (b) Name the appropriate relationship and draw a diagram of the appropriate relationship. • Hassan likes to play Computer Science Form 4 Subject (a) Identify the entities in the above relationship. • Samy likes to play football. learn Given the following relationship. • Jeremy likes to play hockey. Student football Based on Example 5, answer the following questions. Mind Test contact name Object entity Relationship Set 212 Machine Translated by Google


Example 6 • Ali deposits A0150. account type • Adam deposit A0109. Given the following relationships. identification card (b) (a) In the example above, the entities Adam, Ali and Barbara are each subject entities of type Bank Customer. Entities A0109, A0150 and A1011 are each Account type object entities. All entity pairs, namely Adam-A0109, Ali-A0150 and Barbara-A1011 have the same relationship which is deposit. Solution: name number (b) Draw a suitable relationship diagram. account balance (a) Identify the entities in the relationships above. address • Barbara deposit A1011. Cardinality ( Cardinality refers to the relationship between entities. Cardinality specifies the number of entities that can be connected to other entities through a set of relationships. A complete diagram should show the attributes of the entity. See Figure 2.22. The example above uses a simple connected diagram. In relation set design, several types of cardinality will be used. Among them is one-to-one (1:1), one-to-many (1:M) or many-to-many (M:N) cardinality. Cardinality is based on user needs. In a connected diagram, cardinality is written on both the lines connecting entities to relations and relations to entities. See Table 2.4. Figure 2.22 A complete diagram showing the attributes of an entity Bank customers Account learn CHAPTER 2 DATA BASE Bank customers Account deposit Cardinality ) 213 Machine Translated by Google


(one-to-one) 1:M Example: A citizen has only one identity card. Attribute value 1 for Attribute 2 Example: A relationship between many entities and many other entities. Many customers of a supermarket buy various types of goods. (many-to-many) Attribute 2 Attribute value 2 for Record1 Attribute value 1 for 1:1 Record 1 Record2 Attribute 1 Attribute value 2 for Record2 Cardinality (one-to-many) M:N Attribute 1 Record 1 The relationship of one entity with another entity. Attribute value 1 for Attribute value 1 for The relationship of one entity to more than one other entity. A student can join more than one club at school. Attribute value 2 for Record2 Attribute value 2 for Record1 Description Example: Record2 The diagram is connected Table A In a database, cardinality refers to the relationship between records in one table (say table A) to records in another table (say table B). For a 1:1 cardinality, one row of records in table A can only be linked to one row of records in table B. If the cardinality is 1:M, one row of records in table A can be linked to one or more rows of records in table B; but each record in table B can only have a relationship with one row of records in table A. How is the relationship between the records between table A and table B if the cardinality is M:N? Schedule B 214 own identification Student Computer Science Form 4 Card cardinality M:N Figure 2.23 The number of relationships between the records in table A and table B respectively N M Table 2.4 Cardinality M 1 1 Citizens buy 1 Club Customers join item Machine Translated by Google


34 2 Data entered into the computer and stored in memory can be lost when the power supply is cut off. What do you need to do to ensure that the data remains stored in the computer's memory? VietJet Air Data integrity refers to the process of maintaining and ensuring valid data integrity through the entire data lifecycle. Melaka, Johor (c) Malaysia Airlines, AirAsia, Garuda, Singapore Airlines, Thai Airways, your answer. 5 Identify the cardinality of the relationship set shown below. Give justification for (b) Perlis, Kedah, Penang, Perak, Selangor, Negeri Sembilan, 1 State whether the following statements are true or false. (a) History, Science, English, Mathematics (c) M:N 1 Determine the appropriate entity for each of the following data sets: (b) 1:M (a) 1:1 LECTURER 4 Based on the diagram below, define the entities and attributes correctly. Discuss in groups and present to classmates about the questions below. Explain to your classmates why you chose that answer. 2 In addition to the examples already given, give everyday examples for the following cardinalities. Discuss in your group. 3 What do you understand by data consistency? Justify your answer with examples. 215 Formative Training 2.1 Career Science Student Course Entities, Attributes, Relationships and Cardinality Name AMEN011 Chong Wei Hou Faculty of Science Lecturer ID Faculty • Database administrator (DBA) • Designer CHONG012 Language CHAPTER 2 DATA BASE Database technology has created four types of professions as follows: • Data administrator (DA) Amen to Darus register Course database • Application developer JAVA Computer Malay Teamwork Machine Translated by Google


(a) • Tze-Ming took the Additional Mathematics exam. (b) Subjects • Terry Embong took the Accounting exam. • Rahmat took the Chemistry exam. 10 Given the following relationships. Draw a suitable simple connected diagram • Ganesh took the Accounting exam. 9 Determine the attributes that correspond to the following entities by drawing a connected diagram for each entity. 8 Using a search engine, find and study what are the advantages and disadvantages between the network database model and the relational database model. Give justification for your answer. after identifying the names of the entities and the names of the appropriate relationships: 7 Aaron son of Jili, Lee and Muthusamy are completing an assignment on the Smart Form 5 Pupil Information database given by the teacher. A total of 25 Smart 5th grade students are involved. While checking the data obtained from the Smart 5 students, Lee found that there was an excess of two data whose cause is unknown, bringing the total data to 27. What happened? Give justification for your answer. (a) Teacher 6 What is the difference between the database models below? Fill in the blanks in the table provided. Talk to your friends. You can also use a search engine to find information and complete your answer. 216 990405-11-5434 Suraj A/L Ramu 990213-03-5675 05 May 1999 5 Smart Students name 5 Smart February 13, 1999 Deficiencies Lim Kit Wu Relational model 990607-14-4343 Aliza bt Wan Ahmad Class Network 07 June 1999 Aliza bt Wan Ahmad 5 Smart 5 Smart 990213-03-5675 Network model Object oriented Advantage Student IC Lim Kit Wu February 13, 1999 5 Smart 990405-11-5434 Computer Science Form 4 Date of birth Relationship 05 May 1999 Hierarchy Machine Translated by Google


• A student takes one or more subjects at school. • A subject can be taken by one or more students. • A student has data such as name, identification card and level. • A subject has data such as the name and the name of the teacher who teaches. • Teacher Dinesh teaches Additional Mathematics. • Teacher Chong teaches Malay. • Teacher Sarah Nyelong teaches History. 11 Draw a complete connected diagram that corresponds to the following information. (b) • Teacher Saad teaches Modern Mathematics. (c) • Car manufacturer Proton produces the Iriz car model. • Car manufacturer Proton produces the Perdana car model. • Car manufacturer Perodua released the Axia car model. • Car manufacturer Perodua released the Bezza car model. • The Honda car manufacturer produces the Civic car model. • The Toyota car manufacturer produces the Camry car model. 217 CHAPTER 2 DATA BASE Machine Translated by Google


LEARNING STANDARDS STANDARD CONTENTS A database with a relational model can be used to effectively overcome the problem of redundancy and data inconsistency. See the table in Figure 2.24. The table contains a list of book borrowers and the return date of each borrowed book. This table is wide because it contains many attribute columns. Wide tables tend to contain many rows of records that repeat the attribute values same Original schedule BORROWER schedule LOAN schedule Therefore, a wide table can be broken into several smaller relational tables. These tables will be stored in the database. This method is called normalization and is used to prevent redundancy and loss of data consistency. 218 Base 2.2.2 Produce an entity relationship diagram (ERD) to model relational data Figure 2.24 Table normalization to produce relational tables Data 2.2.3 Designing a relational database by converting an ERD to a relational schema 2.2.5 Implement the data normalization process up to 3NF against the relational schema 2.2.1 Determine the appropriate primary key and/or foreign key for each entity 2.2.4 Explain the concept of full functional dependency, partial functional dependency and transitive functional dependency Computer Science Form 4 2.2 Base Design Contact Data Machine Translated by Google


you ? Did you know? Mind Test CHAPTER 2 DATA BASE Accessibility refers to the sharing of data for different users Imagine you are given a table that has a record of every 4th grader in your school. The table contains the student's name, date of birth and home address. In your opinion, which one is best used as a primary key? Table 2.4 Characteristics and importance of primary keys the line. Primary lock Characteristics •Can't have the same value repeatedly. • Fixed and unchanging value. •Has a unique value that is the only one. • Can't be left empty (null) that is without filling in the data 2.2.1 Primary Key and Foreign Key A relational key is the name of a specific attribute in a table that is used to maintain relational data integrity. There are two relationship keys which are primary key and foreign key. The question is, how can a wide table be broken down into relational tables effectively? Can searches be performed across these relationships, as if they had been resumed to the original table when necessary? In the relational database model, specific columns in the relationships are used as logical links. This link allows attributes to be linked again during lookups or updates. This is called relational data integrity. Without connectors, attributes in relationships are difficult to track and this can affect data consistency and accessibility. As such, the database is said to fail to maintain relational data integrity. Remember the relationship set? In a relationship set, an entity can be related to another entity. Entities are represented as tables in the database. Relational keys link the tables that represent the entities in the relation set. A primary key is an attribute (or combination of attributes) with a unique value to represent each row of records in a table. Primary keys cannot be left empty (null ) and cannot contain repeated values. Analogously, the primary key is like a unique identification card number that is suitable for identifying the identity of every student who is a Malaysian citizen. Therefore, the use of a name for an entity is not appropriate because the name can sometimes be repeated for the occurrence of other entities. In the Borrower entity (See the BORROWER table in Figure 2.24), the Student ID attribute is suitable as a primary key because it does not have repeating attribute values. Table 2.4 shows the characteristics and importance of primary keys. 219 Machine Translated by Google


A foreign key is an attribute that contains the primary key value from the target table. In other words, to create a relationship between two tables, the table that wants to create the relationship will add the primary key attribute from the target table as a foreign key. See Figure 2.25 below. LOAN schedule BORROWER schedule goo.gl/0oah1m Mind Test Primary key vs foreign key Figure 2.25 The relationship between the primary key and the foreign key using the LOAN and BORROWER relationship table example Computer Science Form 4 After learning about primary key and foreign key, state the difference between primary key and foreign key. 220 Primary lock Foreign key Primary lock •Ensure that each old record stored does not overlap Importance with a new record. Next, can save computer storage space. • Avoiding duplication of data from records in the database. •Provides a unique identity for each record stored in • Facilitating the search process and access to records. Record what you want to find can be achieved by doing a search using the primary key. •Making the stored data is intact because every the same is repeatedly stored in the database. the record has a unique value as self-identification. Machine Translated by Google


Did you know? you ? (b) Only one primary key can be found in one table as opposed to many foreign keys found in one table. There are several differences between primary keys and foreign keys. Mind Test School Among them are, Table 2.5 Characteristics and importance of primary keys CHAPTER 2 DATA BASE Apart from using the book code example and the student ID, try to show the relationship between the primary key and the foreign key through the student's marks for the Form 4 Computer Science subject and the student ID. Good luck! (a) Primary key does not accept null value while foreign key can accept some null value. Storage of Library Loan Records Teamwork (a) In the BORROWER Table, the primary key is Student_ID. Note that the same attribute appears in the LOAN Table as a foreign key. Take a trip to the school library. One of the uses of the library is as a place to borrow books. Interview librarians to identify the following: (a) Enter data samples to create new records. Recommended 20 lines of records for three borrowers. Use a pencil. there are four attributes namely Book Code, Student ID, Borrow Date and Return Date. (a) In the Loan relationship table, (b) Have old records had to be corrected due to errors or data changes? (a) How does the library find data from such a large number of records? 2 How can the data be used? (c) In addition to the Book Code attribute, another interesting attribute is the Student ID. Note that the Student ID attribute is the primary key in the BORROWER Table. Therefore, ID_Murid in the LOAN Table becomes a link to the BORROWER Table. Student_ID is a foreign key in the LOAN Table. (c) Change one of the data, for example the identification card number of one of the students. Does this change also affect other records? The uniqueness of the value makes the book code attribute the primary key. (b) How are the data stored? (a) Why is the recorded data important? BORROWER schedule (b) The column for the Book Code attribute cannot be empty, and each attribute value is unique (no repetition). (b) Use a highlighter pen to color repeated groups of data. If the groups are the same, use the same color. (b) Does the BORROWER table have foreign keys? The BORROWER table has no foreign keys because there is no relationship to the primary key. 1 What data needs to be recorded for each loan? LOAN schedule 3 Draw a table to keep loan records. 35 Table 2.5 describes the use of relationship keys in the LOAN relationship table and the BORROWER relationship table. 221 Machine Translated by Google


goo.gl/mXfT3q Table 2.6 Examples of common entities People goo.gl/4PB9wD Entity Relationship Diagram (ERD) Products, vehicles, equipment, buildings ER Diagram Representation 5 4 Registration, application, appeal, inquiry, transaction Country, state, district, city, village Computer Science Form 4 3 Figure 2.26 Entity symbols in ERD Teacher, student, doctor Concept 2 Figure 2.27 Relationship symbol 1 Event Object Place Account, course No Entity Type Example 222 Relationship Entity An entity is something that has data to store. Entities are usually labeled with nouns. The entity symbol is a square with the entity name in the middle. An entity can consist of environmental elements (people, objects, places, concepts and events). Physical entities of people, objects and places. Concepts and events are abstract. An example of each is given in Table 2.6. An Entity Relationship Diagram (ERD) is a graphical technique for modeling data. The model produced is at a conceptual level and is not tied to any Database Management System (DBMS). ERD represents the environment in entity structure, entity relationships and entity attributes. A relationship is an association that exists between two entities. Relationships are usually labeled using verbs. The relationship symbol is a rhombus. Entity Name Verb The basic components of ERD are: Examples: register, have, fill, borrow 2.2.2 Picture of Entity Relationship Diagram (ERD) Machine Translated by Google


Did you know? you ? ERD, namely: There are several types Construct an entity relationship diagram based on Jasmin Kaur's situation. Figure 2.29 Attribute symbols Figure 2.30 Attributes of the student entity various types of books consisting of various genres such as fiction, nonfiction, encyclopedias, novels and bibliographies. CHAPTER 2 DATA BASE (c) Physical ERD Jasmin Kaur is interested in reading. He often goes to book fairs to buy www.lucidchart.com Mind Test (b) logical ERD Source: (a) Conceptual ERD Figure 2.28 Relationship between entities 223 Attributes Figure 2.30 shows the Student entity has attributes such as Student ID, Name and Level. 1 Identify the entities: Pupil, Exam Examples of use: Student 2 Identify groups for logically related data. 1 Identify the data required by the system from the database environment. Course Examples of attributes for the student entity: student ID, name, level, gender Here are the steps to draw an ERD for the statement "Student takes Exam". The steps for drawing an ERD are as follows: Figure 2.28 shows the "register" relationship between the Student subject entity and the Course object entity. The following diagram can be read as "Student Enrolling Course." register 2 Identify the relationship: take Name Examples of use: Name An attribute is a characteristic or property of an entity. Each entity set consists of several attributes. Attributes are represented by ellipse symbols. Example 1 3 Identify the relationship between two entities for all entities. Student Level entity. 3 Draw the symbol of the entity and the relationship that links the two Student ID These groups are named as entities. Machine Translated by Google


1 M 1 N "A citizen has only one identity card." 1 1:M (one-to-many) Relationship: M "A student can join more than one club at school." 1:1 (one-to-one) M:N (many-to-many) "Many supermarket customers buy a wide variety of goods." Cardinality Relationship: 36 ERD Relationship: Description Computer Science Form 4 Table 2.7 Types of cardinality goo.gl/4PB9wD ERD Teamwork A student is allowed to join a maximum of three clubs only. In your class, create a list of student details. These details are required to record each student's contribution to the class fund every month (12 months). Determine the entities and information information required for each student. Draw an Entity Relationship Diagram for that purpose. Give justification why the information is needed. Determine the entities and information required for the club. Draw an Entity Relationship Diagram for that purpose. Provide justification as to why the information is needed. Each student may join one or more clubs at school. A B join Identification card Club Customers Item Student buy Citizens have take Cardinality indicates the quantity of entities in a relationship. See Table 2.7. Student Examination Remember the concept of cardinality in relational databases? 224 Machine Translated by Google


1 2 3 Did you know? you ? Firm entities Joint entity com Figure 2.32 ERD for the Student entity An entity that occurs together with one or more other entity types. This entity exists independently of other entities. CHAPTER 2 DATA BASE Weak entities Source: ecomputernotes. Entities consist of three types namely: This entity depends on other entities of the same type. Figure 2.31 Considerations in database design The design must use an appropriate model, for example the popular relational database model. Gender How is a suitable database designed for use in information systems? The design of a relational table should meet the considerations listed above. This is done systematically. After identifying the entities, attributes, relationships between entities and cardinality through ERD, the next step is to produce a set of relationships. The ERD for the Student entity is given as in the following figure. The design must contain only complete and necessary data. Student ID Considerations in database design Level Name The design should facilitate storage, retrieval and updating. A relation set is a set of attributes in a relation table. A relation set is prepared during the process of planning and designing a database that describes the entities to be stored, the required attributes and the relationships between those entities. Relationship sets are generated from ERDs and can be expressed in two formats, namely: Student 2.2.3 Designing a Relational Database 225 Machine Translated by Google


Did you know? you ? Format: ENTITY NAME(Attribute 1<KP>, Attribute 2,….Attribute N) Attributes... Text statements are easy to generate. The name of the entity is written and then followed by parentheses. In parentheses, the attributes of the entity are written. Attributes that serve as primary keys are denoted by adding "<KP>" after the attribute name. Attributes that function as foreign keys are marked by adding "<KA>". The example given shows that the STUDENT entity has the attributes IDMurid, Name, Gender and Level. IDMurid is chosen as the primary key because IDMurid represents each record row uniquely. Level Level Gender IDMurid<KP> Example: Attribute 1<KP> Gender IDMurid<KP> You can notice that the relationship set contains the same details as the ERD. The following diagram shows how an ERD can be easily translated into a set of relationships. (a) Text statement (b) Graphical representation Gender Name Example 1: Student(IDMurid<KP>, Name, Gender, Level) ENTITY NAME Student ID Attribute 2 Level Name STUDENTS Attribute-N Graphical representation using a one-line table. The name of the entity is written above the row of the table. The number of columns required depends on the number of attributes. Primary keys are the same as text representations, i.e. primary keys are marked with "<KP>" while foreign keys are marked with "<KA>". Name STUDENTS Student Format: 226 two techniques in design form of database? Mind Test ERD is suitable for sketching entities, attributes and relationships. Figure 2.33 Converting the student entity ERD to a relation set Relationship sets are more suitable for analysis involving entity structures that are changed repeatedly. What is the second role Between ERD and relational schema, which is easier to edit? Computer Science Form 4 Machine Translated by Google


Individual Activities For example, in the student table, attributes such as Name, Gender and Level depend on the primary key attribute, IDMurid. Between ERD and relationship set, which is easier to edit? ERD is suitable for sketching entities, attributes and relationships. Relationship sets are more suitable for analysis involving entity structures that are edited repeatedly. Each attribute in the table depends on the primary key attribute. What is the role of both techniques in database design? Analyzing dependencies allows a table to be broken into several smaller relational tables to reduce data redundancy without compromising referential integrity. This process is called normalization and understanding the concept of dependency is very important for this process. Table 2.8 shows the types of dependencies. Full functional dependencies Transitive functional dependencies Occurs when the attributes are fully dependent on all key attributes in the table. Occurs when attributes depend on other common attributes in the table. Partial functional dependencies Occurs when the attributes depend on one of the key attributes in the table. Description Based on the situation above, you are required to produce an ERD. Dependency Type SMK Pahlawan held a competition "They create a Robot Replica" at the school level. There are 50 entries from Form 3 to Form 5 students. Each student needs to fill in an entry form that has information such as name, identity card number, age, gender, level and class. Then, convert the ERD to relation set form. 227 you ? Did you know? A weak link indicates a weak connection between things A relationship shows the relationship between entities. entity. 37 Converting an ERD to a Relationship Set Relationships provide useful information to explain the type of an entity. Table 2.8 Types of dependencies CHAPTER 2 DATA BASE 2.2.4 Full, partial and transitive functional dependence Machine Translated by Google


depends Primary lock Primary lock to In your opinion, how do you tell the difference? Figure 2.34 LOAN BOOK Table Figure 2.35 Example of full function dependency Another full function dependency is between Borrower Date with primary key NoBuku and Borrower ID. Mind Test between full functional dependency, partial dependency and transitive dependency? Computer Science Form 4 228 Full Functionality Dependencies Date Aman Book Code Book Name Author Student ID Maruyama et al Date Shirley Jr Aman Aman Programming IPB051325 Information Embong Graphics Introduction IPB257868 C Programming MA Bakar 125007 Harris bin Engineering 0121122335 28-Sep-2016 11-Oct-2016 Mobile Borrow 0176677889 27-Sep-2016 10-Oct-2016 Embong Send IPB192254 Computer Systems, an Student Farah et al 125096 Francis IPB124044 Java 125007 Harris bin 125007 Harris bin 0176677889 27-Sep-2016 10-Oct-2016 IPB051375 Software 0176677889 27-Sep-2016 10-Oct-2016 Name Telephone No Roger Estaine 125096 Francis 0121122335 28-Sep-2016 11-Oct-2016 Book Code To understand further, consider the example in Figure 2.34. This table is a loan book table to record the details of students who borrow and the date the book is sent. In this table, only Book Code and Student ID attributes are primary keys. Note that the Submit Date attribute depends on two primary keys, namely Book Code and Student ID. If one of the primary keys is missing, the book's Ship Date cannot be determined. So, SubmitDate has a full functional dependency on both primary keys. Student ID Date of submit Machine Translated by Google


Apart from the three types of functional dependencies that you have learned, there are still two types of functional dependencies, namely, single functional dependencies and trivial functional dependencies. Functional Dependencies CHAPTER 2 DATA BASE Figure 2.36 Example of partial functional dependency You are tasked with building a schedule of participating participants for a Reading Campaign. In the table it is necessary to have the participant's name, participant's identification card number, mobile phone number, level and class. From the table you have built, identify the primary key and foreign key. Then, based on Figure 2.35, Figure 2.36 and Figure 2.37, build diagrams for full functional dependency, partial functional dependency and transitive functional dependency. depends depends Not a primary key to Figure 2.37 Examples of transitive function dependencies to Transitive Function Dependencies Partial Functional Dependencies 229 Individuals Book Name Note also that in Figure 2.36, the Book Name attribute depends on the Book Code only and not both the Book Code and the Student ID. Student ID Students name So, BookName has a partial functional dependency on the Book code. Book Code Mobile Phone No So, the dependency between the Student Name attribute and the Mobile Phone Number attribute is a type of transitive function dependency. In the example given, it is well known that the Mobile Number is unique to its owner. Therefore, it is reasonable if there is a dependency between Student Name and Mobile Phone Number. A transitive functional dependency is a dependency that does not involve any of the primary key attributes in the table of Figure 2.37. you ? Did you know? 38 Machine Translated by Google


Normalization is a method of analyzing tables based on key attributes and functional dependencies with the aim of reducing data duplication in the database. Normalization, in general, will break the 0NF table into two or more normalized relational tables , see Figure 2.39. For this reason, a new table needs to be checked first before being implemented in the database system. Check whether the table is normal or not. If it is not normalized, take the appropriate steps to change the table to a normalized form. An example of an 0NF table is as in Figure 2.38. Many duplicate values of attributes such as Student ID, Student Name and Mobile Phone Number for each book loan can be seen. Note also that the columns in the 0NF table are not atomic because there are combinations of attributes to form a single column. The Book column contains a combination of Book Code, Book Name and Author columns. Name Maruyama et al Telephone No Borrow 125007 Harris bin IPB257868 C Programming MA Bakar 125007 Harris bin Send Graphics Book Code Book Name Author Student ID 125007 Harris bin IPB051325 Information 0121122335 28-Sep-2016 11-Oct-2016 0176677889 27-Sep-2016 10-Oct-2016 Roger Estaine 125096 Francis Programming Engineering Introduction Student Embong Student 0176677889 27-Sep-2016 10-Oct-2016 0176677889 27-Sep-2016 10-Oct-2016 Aman Aman Aman Date 0121122335 28-Sep-2016 11-Oct-2016 Embong Date Mobile IPB192254 Computer IPB124044 Java IPB051375 Software Systems, an Books Shirley Jr Farah et al 125096 Francis Computer Science Form 4 The 0NF table has many duplicate attribute values Figure 2.38 BOOK LOAN table in 0NF form New Table Relation Schemas are usually in denormalized form, or 0NF. 0NF tables can work but will cause a lot of redundant data storage and can affect data integrity when carelessness occurs during updates. Therefore, 0NF tables are not suitable for implementation in database systems. 2.2.5 Data Normalization Process Up to 3NF Against 230 Machine Translated by Google


IPB051375 Software Engineering 0121122335 28-Sep-2016 11-Oct-2016 28-Sep-2016 Harris bin Aman 0176677889 125007 Harris bin Student ID Book Code Borrow Date Send Date Graphics Students name Farah et al Send MA Bakar Aman Date 11-Oct-2016 0121122335 28-Sep-2016 11-Oct-2016 Francis Embong 0121122335 Francis Embong Student IPB257868 125007 125007 Harris bin IPB051325 Information Aman 125007 IPB051375 Software IPB124044 125007 Books Farah et al 125096 Francis IPB124044 Java 27-Sep-2016 0176677889 27-Sep-2016 10-Oct-2016 Borrow IPB124044 Java Programming Shirley Jr Telephone No 27-Sep-2016 Aman IPB051325 Information Systems, an Introduction 11-Oct-2016 Harris bin Aman 27-Sep-2016 Student's Name Mobile Phone Number Engineering Student 10-Oct-2016 Programming Embong IPB257868 C Programming Date Mobile Book Code 10-Oct-2016 Roger Estaine 125096 Francis IPB051325 125096 Author Systems, an 0176677889 27-Sep-2016 10-Oct-2016 Shirley Jr Name IPB051375 125096 0176677889 27-Sep-2016 10-Oct-2016 IPB192254 Computer Graphics Maruyama et al IPB192254 Computer Roger Estein Student ID Embong Book Code Book Name Author Student ID Book Name IPB192254 125007 Maruyama et al 28-Sep-2016 IPB257868 C Programming MA Bakar 125007 Harris bin Introduction 10-Oct-2016 125096 CHAPTER 2 DATA BASE 231 Figure 2.39 Normalization of the 0NF table LOAN BOOK to the 3NF relation tables LOAN, BOOK, STUDENT and TELEPHONE Normalization Table of BOOKS LOAN schedule TELEPHONE Schedule Original table (0NF): LOAN BOOK STUDENT schedule Machine Translated by Google


Figure 2.40 BOOK LOAN Table in 1NF form Primary lock Student, Mobile Phone Number, Borrow Date, Send Date) Computer Science Form 4 LOAN BOOKS (Book Code <KP>, Book Name, Author, Pupil ID <KP>, Name ENTITY NAME (attribute 1 primary key <KP>, attribute 2 foreign key <KA>, attribute 3, attribute 4, ...) 232 Name IPB257868 C Programming MA Bakar 125007 Harris bin Maruyama et al Borrow IPB124044 Java 0176677889 27-Sep-2016 10-Oct-2016 Send Engineering Aman Embong Farah et al 125096 Francis Graphics Systems, an 0176677889 27-Sep-2016 10-Oct-2016 125007 Harris bin 0176677889 27-Sep-2016 10-Oct-2016 Mobile 0121122335 28-Sep-2016 11-Oct-2016 Student Aman Roger Estaine 125096 Francis IPB051325 Information Programming IPB192254 Computer Date Introduction Date 125007 Harris bin IPB051375 Software Book Code Book Name Author Student ID Shirley Jr Embong Telephone No Aman 0121122335 28-Sep-2016 11-Oct-2016 1 Convert the 0NF relational schema to 1NF A 1NF relational schema contains all the attributes in the original table. Identify the primary key by examining the full functional dependency relationship between the attributes in the schema or table. Mark attributes that are primary keys using the "<KP>" suffix. See the following example. Example: The objective of the conversion is to ensure that table columns are atomic and have primary keys. The first step is to ensure the atomicity of the data by using one column for each attribute. See Figure 2.40. Normalization is done systematically and in stages. Generally, there are three forms of normalization namely 1NF, 2NF and 3NF. Normalization is done until the table reaches the 2NF or 3NF level. Follow the steps as follows: Based on the 1NF table, generate a relational schema. A relational schema shows the structure of tables in a database. Use the table (entity) name in capital letters followed by a list of attributes in parentheses. The relation schema syntax is as follows: Machine Translated by Google


Student, Mobile Phone Number), Borrow Date, Send Date) STUDENT (Student ID <KP>, Student Name, Mobile Phone Number) STUDENT (Student ID <KP>, Student Name, Mobile Phone Number) LOAN BOOK (Book Code <KP>, Book Name, Author, (Pupil ID <KP>, Name CHAPTER 2 DATA BASE LOAN (Book Code <KP>, Book Name, Author, Student ID <KP> <KA>, Borrow Date, Send Date) 233 connect LOAN BOOKS (Book Code <KP>, Book Name, Author, (), Borrow Date, Send Date) 2 Convert 1NF relational schemas to 2NF Separate the attributes of the repeating data group and give it the name of the entity Student. Change the LOAN BOOK table name to LOAN. For the Student entity, make the Student ID the primary key because the Student ID helps identify other attribute values uniquely. Add suffix <KP> to Student ID. The same Pupil ID attribute is maintained in the LOAN table but made also as a foreign key attribute, adding the suffix <KA>. The objective of converting 1NF to 2NF form is to eliminate partial functional dependencies. 1NF tables have partial functional dependencies. Therefore, identify groups of repeating data sets and break them into separate tables called relational tables. Keep the <KP> suffix for both attributes. Example: Start by analyzing the 1NF table LOAN BOOK. In the original scheme, it is found from the data in the table that the attributes that have repeating data groups are Student ID, Student Name and Mobile Phone Number. Use parentheses to mark repeating groups of data. Study the 1NF schema by finding dependencies between non-key attributes and primary key attributes. A partial functional dependency occurs when a common attribute depends on only one of the primary key attributes. Identify those attribute groups and isolate them as new relational schemas. •Make sure the Student table has the Student ID attribute as the primary key. •Make sure the tables are linked through primary key and foreign key attribute pairs which is correct, which is Student ID <KA> in the LOAN table to Student ID <KP> in the STUDENT table. •Check the Loan schedule. Make sure the Book Code and Student ID attributes remain as primary keys. Note: Machine Translated by Google


depends partial function to connect LOAN (Book Code <KP> <KA>, Student ID <KP> <KA>, Borrow Date, Send Date) STUDENT (Student ID <KP>, Student Name, Mobile Phone Number) BOOK (Book Code <KP>, Book Name, Author) STUDENT (Student ID <KP>, Student Name, Mobile Phone Number) Computer Science Form 4 BOOK (Book Code <KP>, Book Name, Author) LOAN (Book Code <KP> <KA>, Student ID <KP> <KA>, Borrow Date, Date Send) 234 LOAN (Book Code <KP>, Book Name, Author, Student ID <KP> <KA>, Borrow Date, Send Date) Note: The result of the normalization produces the following 2NF table relationship scheme. Does the 1NF table LOAN have partial function dependencies? Apply the same analysis to the STUDENT 1NF table. The STUDENT table has no partial function dependencies. Therefore, the STUDENT table is already in 2NF form. Both the resulting LOAN and STUDENT tables are still in 1NF as long as they contain partial functional dependencies. Let's analyze the two tables for any possible residual partial functional dependencies. there is, then the LOAN table and the BOOK table are already 2NF tables. Therefore, groups of data attributes with partial functional dependencies are isolated as new relational schemas. Give the Book entity name. only although Student ID is also the primary key. Therefore, the LOANS table has a partial functional dependency between Book Name and Author with Book Code. •Check both tables for the existence of other partial functional dependencies. If not the same, the Book Code is also a foreign key to link the LOAN table to the BOOK table. Add the suffix <KA> to the Book Code of the LOAN table. •The Book Name and Author attributes depend on the primary key of the Book Code •Check the LOAN table. The Book Code attribute remains one of the primary keys. On time primary key Book Code and Pupil ID. This is a full function dependency. •Check the BOOK schedule. The Book Code attribute is used as the primary key. •In the LOAN table, the Borrow Date and the Send Date are fully dependent on both Machine Translated by Google


depends partial function to connect you ? Did you know? An example is the Boyce-Codd Normalized Form (BCNF). CHAPTER 2 DATA BASE There are higher forms of normalization than 3NF. goo.gl/Pv1IaY STUDENT (Student ID <KP>, Mobile Phone Number <KA>) TELEPHONE (Mobile Phone Number <KP>, Student Name) STUDENT (Student ID <KP>, Student Name, Mobile Phone Number) If you look carefully, the STUDENT scheme has three attributes Student ID, Student Name and Mobile Phone Number. The Student ID is the primary key and therefore both the Student Name and Mobile Number attributes depend on the Student ID. But at the same time, the Student Name attribute also depends on the Mobile Phone Number even though the Mobile Phone Number is not a primary key. This is a transitive functional dependency. 3 Convert 2NF relational schemas to 3NF The objective of the conversion is to eliminate transitive function dependencies. Normally, normalization up to the 2NF level is sufficient. Normalization to the 3NF level is only necessary in situations where there are transitive functional dependencies between attributes in some tables. This dependency is hidden because it exists between normal attributes, ie it does not involve the primary key attribute. Usually, this can be identified from the experience of using the data. Therefore, isolate the transitive function by creating a new schema, PHONE. Examine the relational schema of the STUDENT table to find transitive function dependencies: Example: What about other 2NF tables such as LOANS and BOOKS? Because the analysis of both the LOAN and BOOK table schemas does not produce new dependencies, the tables do not have 3NF form. The PHONE contact schema contains attributes Student Name and Mobile Phone Number. Make Student Name as the primary key. In the schema of the STUDENT table, the Cell Phone No attribute is made a foreign key. 235 Machine Translated by Google


Computer Science Form 4 Table 2.9 Types of normal form (Normal Form, NF) Example: 2NF Example: 2. Issue: No issue. Finally, all relational tables have neither partial nor transitive functional dependencies. 1NF: 2. Issue: However, there may be transitive functional dependencies between attributes that have not yet been identified. •Each relational table has a primary key attribute. Example: 1. Objective: Eliminate transitive function dependencies in tables if any. •All relational tables have full functional dependencies only. partial function. 2. Issue: Tables have both full function dependencies and dependencies •Tables have no partial function dependencies. 1. Objectives: •Identify the primary key in the table. •Make sure the column is atomic. 2NF: 1. Objectives: 3NF 3NF: 236 Borrow, Send Date) LOAN (Book Code <KP> <KA>, Pupil ID <KP> <KA>, Date LOAN (Book Code <KP> <KA>, Pupil ID <KP> <KA>, Date BOOK (Book Code <KP>, Book Name, Author) Borrow, Send Date) BOOK (Book Code <KP>, Book Name, Author) STUDENT (Student ID <KP>, Student Name, Mobile Phone Number) STUDENT (Student ID <KP>, Mobile Phone Number <KA>) LOAN BOOKS (Book Code <KP>, Book Name, Author, (ID TELEPHONE (Mobile Phone Number <KP>, Student Name) Date of submit) Pupil <KP>, Pupil Name, Mobile Phone Number), Borrow Date, Normal shape Explanation 1NF The characteristics of the normalization form should be carefully remembered because it can help the analysis of the normal form type of the table and convert the normal form to a higher level, which is 2NF and sometimes 3NF. In conclusion, normal forms are the stages of conversion of a non-normal relationship scheme to relationship schemes that meet the criteria of normal form. The criteria of normal form (NF) are formulated as follows: Machine Translated by Google


39 S0123 Grade 27-Sep-2016 Student (c) 3NF 27-Sep-2016 A+ Subject S0133 Borrow S0211 Modern A 82 Modern Send 28-Sep-2016 29-Sep-2016 Level 125128 Surinamese Goddess In pairs, generate a complete relational diagram and redraw the table above for each of the following normal forms: A– 1 List the importance of primary keys. 80 (b) 2NF Malay 125007 Harris bin Samad 4 Aman 91 A– Product Schedule S0123 Malay 125096 Francis Embong 4 Aman Mathematics Paper S0211 Mathematics 4 Safe Test Code Date A 2 Vendor Schedule Date English 125007 Harris bin Samad 4 Aman 125096 Francis Embong 4 Aman Student ID Student Name 75 Given a sample EXAM schedule as follows: 72 29-Sep-2016 (a) 1NF V00392 Suria Kitchen bk00001234 bk00000023 Delight Baker 31750 2.50 05-3680020 YK Dynamic Supply 60.00 V00205 V00205 12.00 31650 bk00000689 V00205 05-3560123 Sugarcane water (bottle) V00201 60000 Wheat flour (5kg sack) Self-rising flour (can) 03-5040235 V00392 Formative Training 2.2 Product Code Vendor Name Product The unit price Data Normalization CodeVendor CodeVendor PhoneVendor CHAPTER 2 DATA BASE PostcodeVendor Individual Activities 237 Machine Translated by Google


Teacher's name Score Teacher Students name Teach 1 Student M 238 Computer Science Form 4 ) (a) The CodeVendor attribute may not receive any value. ( (b) The PhoneVendor attribute can not receive any value. ( (c) In the Product entity, the primary key is ProductCode while the foreign key is Product. ( (d) Each entity must contain one primary key. ( (e) Each entity must contain a foreign key. ( •A bank customer must have at least one account. (b) What is the objective of (i)? 5 ERD drawings for the following environments: ) ) 7 If something goes wrong in designing the database, what should you do? 6 Give your interpretation for the model in the following ERD: ) ( ) 0NF 8 Decide "true" or "false" for the following statements: ) (a) Identify the normal forms (i) and (ii). ) Refer to the given relationship table and answer questions 2 and 3. 2NF 9 See the diagram summarizing the normalization steps of the following table: (c) What is the objective of (ii)? (b) Identify the primary key in the Product entity. (a) Normalization combines several tables into a single table. (b) Normalization aims to produce fast lookups by producing duplication of data in 2NF tables. ( (c) Normalization reduces redundancy and increases database integrity. ( (d) The primary key attribute allows each record to be uniquely identified. ( (e) Foreign keys are primary keys in the target table. ( (f) Data redundancy and data integrity) are two unrelated database problems. ( (g) Data integrity problems will become apparent when data needs to be updated. ( (h) Tables in 3NF do not have data integrity issues because their structure is not 4 Draw the ERD for the statement "Customer buys Product" •Bank accounts have account number and account balance details. ) ) 3 Mark right (ÿ) or wrong (ÿ). ) (i) ) •Customers have details of name and ID card number. List possible actions you would take to solve the problem. ) (ii) ) (c) Are there foreign keys in the above tables? Explain your answer. ( allow data duplication. (a) Identify the primary key in the Vendor entity. Machine Translated by Google


Customers id Type Service Code CUSTOMER RECORDS CHAPTER 2 DATA BASE Address Take it Service Date Send Price Price Date Customers Code Service Name 239 Albert son 14-Aug-16 Albert son B001 BB001 Change the hard drive K010 Change 01-Sep-16 A0200 Buy a keyboard Bintulu A0001 Buy a keyboard K001 Kuala Krai Muar 1200.00 12.00 14-Aug-16 Tan Kok Seng Nurul 02-Sep-16 02-Aug-16 B001 Thomas 250.00 B1100 B002 Buy a mouse 8.00 12.00 Thomas disc KK010 Motherboard BB001 A0001 BB001 Buy a keyboard Kuala B1000 Bintulu Thilakamalar Loyal to Nature B001 15-Aug-16 BB002 03-Sep-16 Hanif mud 12.00 KK001 01-Sep-16 A8000 10 Based on the CUSTOMER RECORD table below, generate the normalization of ONF to 3NF Machine Translated by Google


Microsoft Access is one of the applications in Microsoft Office. Enter the name and storage location of the database. See Figure 2.42. A database is an integrated collection of data records, files or database object objects. As an analogy, a database is like a file cabinet that is used to store, organize, update and find data records quickly, accurately, neatly and easily. The database is developed using database management system software or database management system (DBMS). Microsoft SQL, MySQL and Oracle SQL. The advantage of Microsoft Access in learning database concepts is the use of "Graphical User Interface" or Graphical User Interface (GUI). To build a database, launch Microsoft Access and select an empty database from the dialog window. Database generation A database management system (DBMS) is a software package with computer programs for the purpose of developing, using and maintaining a database. Examples are Microsoft Access, STANDARD CONTENTS LEARNING STANDARDS 240 2.3 (i) A table uses more than one criteria 2.3.5 Generate reports based on query results 2.3.4 Produce a query to get the information needed again from: Computer Science Form 4 Figure 2.41 Use of a database as an alternative to file cabinet storage and retrieval Figure 2.42 Microsoft Access is one of the applications in Microsoft Office 2.3.3 Entering data in a table through a form Documenting work results 2.3.2 Create a form related to the content of the table 2.3.7 2.3.1 Build tables based on relational schemas using relational database software (iii) Exit the system (ii) Reports (ii) Two tables using one criterion 2.3.6 Produce a simple information system through a macro using a menu (switchboard) that contains: (i) Form Base Development Contact Data Machine Translated by Google


The development of a relational database involves several activities describes the logical structure of data as a combination of attributes that uniquely identify each record row. A relational table represents in the order shown in Figure 2.43. The database contains tables. Contact table (report) Build a report Select Blank Database Enter the name of the database file 2.3.1 Table Construction Based on Relational Schema Using Relational Database Software Database Management System (DBMS) works to complete several tasks. For example: •Processing data that virtual Figure 2.44 Relationship database development activities Figure 2.43 Creating a database CHAPTER 2 DATA BASE • Build an office by State the advantages and disadvantages of each given application. produce graphic images, video and audio. Provide another application name for the DBMS. •As a storage and application for DBMS is Microsoft Access. business through the internet and disseminate information systems. • Build a website complex You have learned that one •Build a network Mind Test Build and fill out forms Create a relationship Build a schedule Build a search (table) (queries) Fill in the table Build a database Edit records you ? Did you know? 241 Machine Translated by Google


Click to View FlipBook Version