Dynamic attributes of the entity solutions in database design

 

 

Wang Yang

Abstract: This paper mainly for database design problems encountered in the dynamic properties of the entity, respectively, combined with relational and non-relational database technology into two categories, provides solutions to solve physical property variability problem: the solution is to get relations change behavior using two columns and relations entities, non-relational model solution is to use HBase and MongoDB model. These programs provide a variety of options for the development of the data needs of users, to provide users with a great convenience.

Keywords: dynamic entity attributes; database design; relational database; non-relational databases

CLC: TP311 Document code: A Article ID: 1009-3044 (2017) 05-0009-02

1 raised the issue of

With the advent of the era of big data, structured data, semi-structured data and unstructured data already widely present in various software applications. Any mobile applications and systems are inseparable from the database for storage of data, and the complexity of data for their development brings difficulties and challenges.

In real life, the social reality of the matter is everything into a dynamic system. With the passage of time and things, the development of various entities will change, embodied in the physical properties change, therefore, we call dynamic attributes of the entity [1]. For example, in a banking client manager entity performance appraisal system, with business development, the account manager's assessment content will change, there will be performance deposit, lending, fund performance, whether the complaints is increasing, too will produce results corresponding values, these are called dynamic performance continue the client manager entity, the details as shown in table 1 client manager entity in January 2017 the business requirements shown in the table.

In the actual project development, a fixed number of clearly entity attributes benefit software developers to design and project development. However, the dynamic properties of the entity, since the number of unknown entity attributes, attribute name is unknown, the system is running, based on business needs, feel free to add new properties, therefore, to the project developer has brought difficulties and challenges. The author in database design After a long practice, to explore the dynamic attributes of the entity to this problem solutions in database design, hoping to provide a reference value for database designers or software developers have the same need.

2 defines the relevant data structure

Data type and data structure of data objects in the database, the content, the nature of a static description of the data object. For convenience of description, further to the above-described performance evaluation system client manager entity described as an example. The client manager entity performance including deposits, loans, business, fund performance, whether complaints properties, which can be defined in a relational database into related fields, specific detailed structure is described as follows:

Create Table ClientManager(

CName nvarchar (50), // name field

CDeposit decimal (18, 2), // field performance deposit

CLoan decimal (18, 2), // loan performance field

CFund decimal (18, 2), // fund performance field

CIsComplain nvarchar (2), // whether to field complaints

... // unknown attribute fields

Obviously, due to the presence of an unknown entity attributes, in the above structure fields are not clear, this design can not be achieved in the current database technology.

3 relational database design methodology entity

Currently, the market for many popular relational database categories, there is Oracle's Oracle, MySQL, there is Microsoft's SQL Server, as well as for mobile applications SQLite. The following issues for the dynamic properties of such entity, given two ways to solve relational database.

3.1 uses behavior change column

In order to change the above-described problem of the field is not clear, it can be seen from Table 1, a two-dimensional field is not clear in the table, instead of the column employed in the form of rows, the unknown value can be as a record stored in a column in the table so it can dynamically increased or decreased to meet the needs of field according to resolve the issue. However, this need to solve two problems. One is the issue of property names and values ​​of another property. Thus, the row into column form, attribute names and values ​​of two-dimensional tables need. Specific client manager entity, defined as the manager's name, the name of the performance and the amount of performance, specific detailed structure is described as follows:

Create Table ClientManager(

CName nvarchar (50), // Managers Name

CAchieveName nvarchar (50), // name field performance

CAchieveValue nvarchar (50) // Amount field performance

In a relational database, the performance and the performance of the amount of client manager entity from the two-dimensional table as rows into the form of a column, however, record the data table increases, its specific form as shown in Table 2 client manager entity lines turn as shown in the columns after the style sheet.

3.2 uses two entity relationship

Using rows into columns simple way to adapt a property value of all the problem of dynamic properties of data types, for example, the amount of performance are all examples of numeric types, developers during development can be achieved when the unified computing function. However, if the property is not a unified type, such as the amount of performance are examples of the type of value, as well as character type. In this case, application developers, during data values, calculates purpose must, in case the data type of the attribute value is not clear, the developer to trouble. Address this complex situation, more information may be added to the value of an entity attribute value table will be described, and an attribute name of an entity as a foreign key, so that it is possible to ensure consistency in the data on the entity. In the example, the account manager entity based on the increase in performance is provided a solid, which have field names results, the amount of the value of the performance type, length value of the amount of performance, the accuracy of the performance values ​​of the amount, specific expressions:

Create Table AchieveSet(

AchieveName nvarchar (50), // name field performance

(50), the amount of the performance // AValueDataType nvarchar value type

The value length AValueLength int, // amount of performance

AValuePrecision int // The value of the amount of precision performance

In summary, by way of transfer line column, the same type of property values ​​to solve the dynamic properties of the problem; to solve complex problems property is non-dynamic properties of the same type by the two entities. Developers according to different needs, a different approach to system development.

Design Method 4 non-relational database entities

With the development of technology, the semi-structured, unstructured data processing, there has been the development of NoSQL data management technology. Below in connection with non-relational data technology, two solutions to solve the given problem of dynamic properties.

4.1 model uses HBase

HBase is a distributed, storing the column-oriented database group [4]. In HBase database, its dynamic properties may be employed to implement data model. Define a group attribute row, and the column may be any group as necessary into the sub-array can be dynamically. Specific operation is to define a client manager entity, creating a performance column group in the entity, the name of the client manager to store manager entity records by key line, described as follows:

create ‘ClientManager,'CAchieve'

Which, ClientManager is a client manager entity, 'CAchieve' is the account manager's performance.

After entity table is created, it may be operated, for storing recording data, operates as follows:

put 'ClientManager', 'John Doe', 'CAchieve: Deposit Performance', '10000'

put 'ClientManager', 'John Doe', 'CAchieve: whether the complaint', 'yes'

put 'ClientManager', 'John Doe', 'CAchieve: fund performance', '10500'

...

Wherein, John Doe HBase column using a row key, 'CAchieve' after the colon is dynamic properties.

4.2 model using MongoDB

MongoDB database is the use of documents, collections and a database of three parts to organize the data [5]. In MongoDB database, the dynamic attribute may be used to implement its data model, implemented according to the mechanism of the document. In an example, using the definition of a set of client manager entity, inserted in the set record file defined, as follows:

db.createCollection ( " 'ClientManager'"); // define a set of client manager

db.ClientManager.insert ({ "name": "John Doe", "deposit performance": 10000, "whether the complaint": a})

db.ClientManager.insert ({ "name": "John Doe", the "Fund Performance": 11000, "whether the complaint": a})

Wherein the data within the braces {} is the document information, stores customer information manager, and each key recorded performance information of the client manager entity, such as "deposit performance": 10000 "and the like in each document. key-value pair may not be the same key, so that it meets the requirements of dynamic properties.

5 summary

To date, relational database theory and non-relational database theory coexist, and they have developed very mature, widely used in the market. From the actual development of a performance appraisal system, evaluation index changing the actual needs, research and summarize several processing solutions for the ever-changing entity properties currently on the market. Alternatively different database technologies according to different schemes, a corresponding technical conditions and equipment conditions in the development process embodiment. In short, we hope to provide some advice and assistance to those who study and work later.

references:

[1] Tang xiaogang, Tan Shiqiang. Entity Relational Database Design method of non-deterministic attributes [J]. Shonan Institute of Technology, 2006 (4).

[2] Lihua Juan. Practical skills of relational database design [J]. Electronics and Software Engineering, 2016 (1).

[3] Li design and implementation of the dynamic field in VFP [J]. Computer Age, 1999 (7).

[4] Lars George. HBase Definitive Guide [M]. People Post Press, 2013.

[5] Zou precious metals. MongoDB management and development of real Comments [M]. China Railway Publishing House, 2013.

"Dynamic properties of an entity in database design solution of" Reprinted from "Computer Knowledge and Technology" Academic Journal, 2017, 5, Author: Wang Yang.

This link: dynamic attributes of the entity in the database design solutions in: https://www.shiwen.org.cn/15457.html [ ]

Guess you like

Origin www.cnblogs.com/Jeely/p/12366036.html