Selection of entity types - Databases: design

Selecting Entity Types

The documentary approach, based on the classical examination of the subject area, involves the creation of entity types, based on the attributes of each document, forming a common set of such types of entities (attribute entities) that their union represents the ratio in the first normal form (Figure 4.2).

An essence type (attribute entity) is a representation of an entity when it consists of one attribute of a simple data type, i.e. is a typed entity.

Fig. 4.2. A set of entity types by attribute analysis

The

In this example, a preliminary analysis of the documents revealed a set of attributes that must be present when building a database model. Let us need to build a database model for the formation of the document D1 Order & quot ;. The document contains 10 attributes, each of which is represented by a separate entity type containing the corresponding attribute of a simple type. However, this view can not be considered absolutely correct, since the document has one attribute, which is inappropriate to consider, considering that it makes sense only within the document and characterizes some instance of the relationship in its presentation in the document. This attribute is the Product Number & quot ;. In fact, its presentation in the document, it shows the analysis of the document, is implemented in the process of reflecting the ordered goods, and the numbering is formed in relation to the document as an object of the domain, and not the storage area of ​​information about the ordered goods. Thus, since the example does not have a task to store information about the object Document and its presentation to the user, then the attribute Item number is meaningless in terms of attitude to the order and the goods. Nevertheless, now we will not remove it from the list of considered attributes and entity types, considering it as an attribute characterizing the order of goods in the order.

When you select the entity types from the document attributes, the developer adds one more characteristic to the ones already available in the document, and the description of the entity types becomes slightly more complete (Table 4.5), taking into account their subsequent representation in the model.

Table 4.5

Description of Entity Types

No.

п/п

Attribute

Entity Type

Tun

/lamihix

Size

nost

Note

1

Order number

Order number

Character

7

2

Order date

Order date

Date

{}

3

Customer

Customer

V archar

150

4

Product Number

Product Number

Integer

{4}

5

Product

Description

Item

Varchar

150

6

Product Price

Product Price

Decimal

7.2

7

Cost

Item

Cost

Item

Decimal

7.2

Calculated:

& lt; 6 & gt; * & lt; 10 & gt;

8

Cost

Order

Cost

Order

Decimal

7.2

Calculated: 511M (& lt; 7 & gt;) for the order & lt; 1 & gt;

9

Character

Cost

Order

Character cost of an order

Varchar

200

It is formed by translating a numeric value into a symbolic expression

10

Number

Item

Number

Item

Integer

{4}

The

The

This description presents the characteristics that are important for the database model:

• data type - description of the types of stored information in terms of the database model, determining at the level of physical implementation of the principles of representation and processing in the database;

• Dimension is a characteristic used for some data types to specify the number of characters (bytes) to use when storing the corresponding value.

In the table for describing entity types, the column Dimension for some data types contains a numeric value, enclosed in braces. This is done for the reason that integer, logical data, as well as date and time in databases, are represented by standard presentation mechanisms and the size in bytes is always known for storing data of these types.

Numerical data types and the logical data type equated to them always have a fixed dimension:

• Boolean, Logical, Tinylnt, Bit - the logical (Boolean, Logical) data type containing the values ​​"True"; (true) and False (false) is identical to a small integer tin (Tinylnt) or bit (Bit) with a minimum dimension of 1 byte (1 bit with a Bit type identity) and O or 1 & quot ;;

• Bit is an integer data type representing the values ​​of About or 1 & quot ;, with a dimension of 1 bit;

• Tinylnt - an integer data type with a dimension of 1 byte;

• Smalllnt - an integer data type with a size of 2 bytes;

• Integer - an integer data type with a size of 4 bytes;

• Biglnt, Long - an integer type of large dimension (8 bytes);

• Date - the date data type represented in the symbolic version, with a dimension of 8 characters (bytes);

• Time - the type of time data represented in the symbolic version, with a dimension of 8 characters (bytes).

For fixed-dimension data types, the Dimension do not fill in, meaning that the indication of the data type itself already defines this and no additional indication is required. For all other types of data, it is important to specify the maximum dimension, taking into account the features of the values ​​that may be present in the document. For numeric data types, specify the number of bytes that should occupy the number and number of digits after the decimal point, determining the accuracy of the real number. Symbolic data types indicate the number of characters that should be stored for the corresponding attribute. The character type can be represented in three different ways:

Text, CLOB is a text data type representing large textual information stored in a special way, and in the database table are shown by a set of the first characters whose number is the dimension of the attribute of that type;

- Character is a string data type that stores exactly the number of characters that is specified as a dimension, filling in the missing characters at the end of the line with spaces;

- Varchar - string data type of variable length, for which dimension determines the maximum number of characters that can be stored in row

.

The Character and Varchar types are very similar in nature, because they define the type of string data, but the features of data representation determine the conditions under which a particular type is applied. So, for storing data having a fixed size (for example, taxpayer identification number, BIN (bank identification code), order number, article number, etc.), they usually use the Character type, since for such data it can not be variants when the number of characters can differ from those specified in the dimension of the attribute. The Varchar type is used in all other cases when there is no need to store the exact number of characters.

Also We Can Offer!

Other services that we offer

If you don’t see the necessary subject, paper type, or topic in our list of available services and examples, don’t worry! We have a number of other academic disciplines to suit the needs of anyone who visits this website looking for help.

How to ...

We made your life easier with putting together a big number of articles and guidelines on how to plan and write different types of assignments (Essay, Research Paper, Dissertation etc)