The present disclosure generally relates to the field of database management and more particularly to a technique for manipulating data from a database and discerning the data in a particular format.
Data are usually stored as 3rd normal form in a relational database. This makes it difficult for an application that needs to present the data in a denormalized format. For example, an application might want to display the purchased product codes for the same customer on a single line.
The database table, PURCHASE_INFO, contains the following records.
In order to show the result as a single row for each customer, users are required to write a recursive SQL. For example,
Here is the result of the above SQL.
As can be seen, the above SQL is unreadable and hard to maintain.
A method of retrieval and presentation of data in denormalized format including, but not limited to, accessing a relational database of CHARACTER or VARCHAR data types in normal form, applying a database command SUMTEXT(column name, delimiter string) to said relational database, retrieving related sets of text strings from said relational database, truncating leading blanks and trailing blanks in each string, limiting the length of each string to a predetermined value, appending related strings using a delimiter string specified, and presenting denormalized data strings.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not necessarily restrictive of the present disclosure. The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate subject matter of the disclosure. Together, the descriptions and the drawings serve to explain the principles of the disclosure.
The numerous advantages of the disclosure may be better understood by those skilled in the art by reference to the accompanying figures in which:
Reference will now be made in detail to the subject matter disclosed, which is illustrated in the accompanying drawings.
The present disclosure is directed to preventing data retrieval difficulty. Referring to
To solve the issue of data retrieval difficulty, a method to access a relational database may provide a new function such as SUMTEXT(column name, delimiter string) that is applied to CHARACTER and VARCHAR data types. This method may remove all leading and trailing blanks before appending, may append the text for the specified column together and may be written as follows:
When the method of use of the SUMTEXT function is specified, the database engine may append the text of the specified column together using the delimiter string specified. Similar to the SUM function in a numerical application, SUMTEXT supports text data. Also, the method of use of the SUMTEXT function will have a predefined maximum length where the presented data will be truncated at this maximum length.
In the present disclosure, the methods disclosed may be implemented as sets of instructions or software readable by a device. Further, it is understood that the specific order or hierarchy of steps in the methods disclosed are examples of exemplary approaches. Based upon design preferences, it is understood that the specific order or hierarchy of steps in the method can be rearranged while remaining within the disclosed subject matter. The accompanying method claims present elements of the various steps in a sample order, and are not necessarily meant to be limited to the specific order or hierarchy presented.
It is believed that the present disclosure and many of its attendant advantages will be understood by the foregoing description, and it will be apparent that various changes may be made in the form, construction and arrangement of the components without departing from the disclosed subject matter or without sacrificing all of its material advantages. The form described is merely explanatory, and it is the intention of the following claims to encompass and include such changes.