First, one designer might ask himself/herself which is all the needed information for the application taken into account a specification. The information can be divided in the following 2 groups depending on if information instances are allowed or not:
Information that cannot have multiple instances. An example of this type of information in an application might be the system time. The application cannot have different system times in a specific moment, but only one, which of course will change during the time, but there will not be several instances in a time instant. For this type of information, there is the possibility that it is clear from the beginning which is the needed amount of needed memory to store such information (as it is the case of the system time) or that it is not clear from the beginning which is the amount of needed memory to store such information, because it can change (e.g. It can be a string of undefined length).
Information that can have multiple instances. An analogy might be established between instance and object. An example of such type of information in the reference application is the photos, and another one is the authors. This is because, there can be multiple photo and author instances, which are present in the same instant of time. Furthermore, it is usual that the number of instances is not predefined a priori, but it can change along the time, as it is the case of the application reference for the photos and authors.
In order to model each one of the elements that can have multiple instances, a table is used, which will include all the information attributes that can have such element, together with the indication of the data type that corresponds with each attribute. In addition, there is an indication of which field or combination of fields make possible to identify whichever instance of this element, distinguishing it from all the rest of instances. This is called as PRIMARY KEY (PK). For example, the PK for the photos could be a unique identifier, and the PK for the authors could be the combination of the name and surname fields, the one that will identify them uniquely.
The structure of the table storing the “photo” elements is:
The structure of the table storing the “author” elements is:
Author | |
---|---|
Field | Data type |
Author_ID |
Integer |
Name (PK) |
String |
Surname (PK) |
String |
Age |
Integer |
Phone |
Integer |
Answer the following questions