Quiz 3: Data Modeling


Foreign key A table is connected to another table through an attribute or a combination of them and that attribute is known as foreign key. Primary key of another table gets attached to this attribute and that's how an association is created and tables are connected to each other. The multiplicity assigned to sale in this case is 1..1 and multiplicity assigned to cash receipt is 0..1 which shows where should the foreign key be posted. The foreign key should be posted to cash receipt. The foreign key could be added to any of the table, but the most logical approach of posting the foreign key is to post it to the cash receipt table. It would mean that whenever a value is added to the cash receipt table it will be available without updating the table. But, if the foreign key is posted to the sales table, after a sale is made, when the information is added to the cash receipt table, two tables will have to be updated so that the foreign key in the sales table is updated. Otherwise, the cash receipt table won't show anything.

Objectives of a structure model: The purpose of a structure model is to support the collection, aggregation, and communication of process information that facilitates the planning and implementation of databases. Option a is correct as structure model represent the entities in the business process and helps to draw the analysis from such databases. Option b is correct as structure model describe the attributes of the entities in that particular business process. Option c is correct as structure model describe the relationship between various entities in the business domain and allows communication of database design. Option d is correct as structure model describe the cardinalities of the entities and show how many instances of one entity can be related to another. Hence all the options are correct, thus the correct option is img .

Associations Associations portray the relationship among classes. It allows one to go through instances of one class and to that of other class. The associations connect two classes through lines. Class diagrams It is a type of Unified Modelling Language (UML) diagram and is structured using UML notations. They have many similarities with entity-relationship diagram. It works as a description of logical structure of the database system. In the question, the doctor F is the owner of a small medical clinic. She practice the method of billing her patients for one amount for their visits and an additional amount for each test she does. The following multiplicities are possible for the associations among the visits of patients, tests, and the patients. The diagram below has some assumptions made as follows: 1. A patient may visit the clinic, but he does not need any diagnostic tests to be done. 2. The tests that are to be done are established in the database before doctor F uses them. 3. The database gets updated with the patients, before the patients make visits. The following class diagram with multiplicities is prepared to show the necessary associations: img In the above diagram, it shows a many-to-many association between tests and patient visits which can be seen through the multiplicities allotted. This means that as many as tests could be made for as many as patients come to visit the clinic. Further, it shows a one-to-many association between patient visits and patients. This means that a single patient can make many patients.