WO2019033511A1 - 基于数据库的数据透视方法、装置和计算机存储介质 - Google Patents

基于数据库的数据透视方法、装置和计算机存储介质 Download PDF

Info

Publication number
WO2019033511A1
WO2019033511A1 PCT/CN2017/103543 CN2017103543W WO2019033511A1 WO 2019033511 A1 WO2019033511 A1 WO 2019033511A1 CN 2017103543 W CN2017103543 W CN 2017103543W WO 2019033511 A1 WO2019033511 A1 WO 2019033511A1
Authority
WO
WIPO (PCT)
Prior art keywords
perspective
pivot
data
parameter
database
Prior art date
Application number
PCT/CN2017/103543
Other languages
English (en)
French (fr)
Inventor
刘开华
孟云雷
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019033511A1 publication Critical patent/WO2019033511A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/211Schema design and management
    • G06F16/213Schema design and management with details for schema evolution support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/214Database migration support

Definitions

  • the present invention relates to the field of data processing, and more particularly to database-based data viewing methods, apparatus, and computer storage media.
  • the existing database mainly focuses on data storage, and needs to be improved in data management and data maintenance.
  • the existing database does not have the function of data perspective. Users need to export data to Excel when they perform data pivoting. Users use Excel data perspective.
  • the table function makes a perspective on the data. This method handles the data with a small amount of data, and the data processing process is cumbersome. For users who are not familiar with the Excel table pivoting function, it is particularly difficult to perform perspective processing on the data in the database.
  • using Excel Pivot function for Pivot time is longer, data processing is less, and there may be problems such as the application of formulas in data Excel data processing table, causing computer to jam, affecting the operation of other programs.
  • the main object of the present invention is to provide a database-based data perspective method, apparatus and computer storage medium, which aims to improve the efficiency of data information perspective in a database and increase the convenience of data perspective by expanding the function of the database.
  • the present invention provides a database-based pivoting method, the database-based pivoting comprising the following steps:
  • a pivot setting window is displayed to prompt the user to set a perspective parameter
  • the pivot range is determined according to the perspective range parameter in the perspective parameter, and the data information in the in-vivo pivot range is obtained;
  • determining the pivot range according to the perspective range parameter in the perspective parameter, and obtaining the data information in the in-vivo pivot range includes:
  • the set perspective parameter is obtained to determine whether the perspective parameter is included in the perspective parameter
  • the pivot range is determined based on the perspective range parameter and the data information in the in-vivo pivot range is obtained.
  • obtaining the set perspective parameter to determine whether the perspective parameter includes the perspective range parameter comprises:
  • the step of performing data pivoting on the data information in the Pivot range and generating the PivotTable includes:
  • the data classification information in the data classification list is counted to generate a pivot table.
  • the step of calculating the data classification information in the data classification list, and the step of generating the pivot table includes:
  • the data classification information in the data classification list is counted in the form of a Cartesian product to generate a pivot table.
  • the step of performing data pivoting on the data information in the Pivot range and generating the PivotTable includes:
  • the method further includes:
  • an export prompt message is displayed to prompt the user to select an export format
  • PivotTable exports the PivotTable based on the user-selected export format.
  • the present invention also provides a database-based pivoting apparatus, the database-based pivoting apparatus comprising: a memory, a processor, and a memory stored on the memory and operable on the processor Database pivoting program, where:
  • a pivot setting window is displayed to prompt the user to set a perspective parameter
  • the pivot range is determined according to the perspective range parameter in the perspective parameter, and the data information in the in-vivo pivot range is obtained;
  • the step of performing data pivoting on the data information in the Pivot range and generating the PivotTable includes:
  • the data classification information in the data classification list is counted to generate a pivot table.
  • the present invention also provides a computer storage medium having a database-based pivot program stored thereon, the database-based pivot program being executed by a processor to implement the above-described The steps of the database's pivot method.
  • a database-based data perspective method includes the following steps: when a database-based pivot request is detected, a pivot setting window is displayed to prompt the user to set a perspective parameter; when the perspective parameter setting is detected Determines the pivot range based on the perspective range parameter in the perspective parameter and obtains data information in the in-vivo pivot range; pivots the data information in the pivot range and generates a pivot table.
  • the data information in the database is pre-imported into the computer memory, and all the data volume is cached into the memory to prevent the database information from being jammed and speed up the processing efficiency of the data.
  • the data information in the database is perspectived and a PivotTable is formed.
  • the user does not need to export the data information in the database to Excel for data pivoting, which avoids the amount of data pivoting in the data view in Excel is small, and the user operation is troublesome.
  • the problem is to realize the convenient, fast and efficient data perspective of the data information in the database.
  • FIG. 1 is a schematic structural diagram of a device in a hardware operating environment according to an embodiment of the present invention
  • FIG. 2 is a schematic flow chart of an embodiment of a database-based data pivoting method according to the present invention
  • step S20 of the database-based data perspective method of FIG. 2 is a schematic flowchart of the refinement of step S20 of the database-based data perspective method of FIG. 2;
  • FIG. 5 is a schematic flowchart diagram of another embodiment of a database-based data pivoting method according to the present invention.
  • FIG. 6 is a schematic diagram of functional modules of a database-based data pivoting apparatus according to an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of a database-based pivot parameter setting interface according to the present invention.
  • FIG. 8 is a schematic diagram of a specific scenario in which various embodiments of a database-based data pivot are combined according to the present invention.
  • FIG. 9 is a schematic diagram of a scenario of database-based data perspective export according to the present invention.
  • the existing data information has a large amount of growth, and most of the existing databases are only used for the storage of data information, and the data management and maintenance mostly rely on data maintenance personnel.
  • the user logs in to the database for data viewing, if data is used, The need to export the data information in the database, and then use other data processing tools to calculate the data, so that the data information stored in the database is used in marketing activities.
  • the main solution of the embodiment of the present invention is: adding a new function to the database, first storing the data information of the database stored in the computer hard disk into the computer memory (cache all the data amount into the memory to prevent the database information from being jammed, Accelerate the efficiency of data processing), users do not need to export the data information in the database, directly in the database for the perspective of the data information, when detecting the user triggers the pivot request, according to the data set parameters set by the user to the data in the database The information is pivoted and the results of the pivot are displayed for output.
  • the invention provides a solution for adding a data perspective function in a database, a user can perform a data perspective in a database, and a user who does not understand the Excel data processing operation can use the data perspective function of the database to improve the efficiency of the marketing activity.
  • FIG. 1 is a schematic structural diagram of a terminal in a hardware operating environment according to an embodiment of the present invention.
  • the terminal in the embodiment of the present invention may be a PC, or may be a mobile terminal device having a display function, such as a smart phone, a tablet computer, or a portable computer.
  • the database-based data pivoting device in the present invention may be a terminal.
  • the component can also run the data program separately, and considering the problem of the amount of database storage, the database-based pivot device can be set on the server, the user accesses the server on the terminal, and the database-based data perspective in the server The device performs a perspective of the data information according to the instructions of the terminal, and transmits the pivot table of the pivot to the terminal.
  • the terminal may include a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002.
  • the communication bus 1002 is used to implement connection communication between these components.
  • the user interface 1003 can include a display, an input unit such as a keyboard, and the optional user interface 1003 can also include a standard wired interface, a wireless interface.
  • the network interface 1004 can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface).
  • the memory 1005 may be a high speed RAM memory or a stable memory (non-volatile) Memory), such as disk storage.
  • the memory 1005 can also optionally be a storage device independent of the aforementioned processor 1001.
  • the terminal may further include a camera, RF (Radio) Frequency, RF) circuits, sensors, audio circuits, WiFi modules, and more.
  • sensors such as light sensors, motion sensors, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display according to the brightness of the ambient light, and the proximity sensor may turn off the display and/or when the mobile terminal moves to the ear. Backlighting.
  • the gravity acceleration sensor can detect the magnitude of acceleration in each direction (usually three axes), and can detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of the mobile terminal (such as horizontal and vertical screen switching, Related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; of course, the mobile terminal can also be equipped with other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc. No longer.
  • terminal structure shown in FIG. 1 does not constitute a limitation to the terminal, and may include more or less components than those illustrated, or a combination of certain components, or different component arrangements.
  • a memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a database-based pivot application.
  • the network interface 1004 is mainly used to connect to the background server and perform data communication with the background server;
  • the user interface 1003 is mainly used to connect the client (user end), and perform data communication with the client;
  • the processor 1001 can be used to invoke a database-based pivot application stored in memory 1005 and do the following:
  • a pivot setting window is displayed to prompt the user to set a perspective parameter
  • the pivot range is determined according to the perspective range parameter in the perspective parameter, and the data information in the in-vivo pivot range is obtained;
  • the processor 1001 may call a database-based pivot application stored in the memory 1005, when the perspective parameter setting is detected, determining the pivot range according to the perspective range parameter in the perspective parameter, and obtaining the in-memory data perspective
  • the data information in the range also performs the following operations:
  • the set perspective parameter is obtained to determine whether the perspective parameter is included in the perspective parameter
  • the pivot range is determined based on the perspective range parameter and the data information in the in-vivo pivot range is obtained.
  • the processor 1001 may invoke the database-based pivot application stored in the memory 1005.
  • the program also does the following:
  • the processor 1001 may invoke a database-based pivot application stored in the memory 1005, which performs data pivoting on the data information within the pivot range, and generates a pivot table to perform the following operations:
  • the data classification information in the data classification list is counted to generate a pivot table.
  • the processor 1001 may call a database-based pivot application stored in the memory 1005, the data classification information in the data classification list is counted, and the generation of the pivot table further performs the following operations:
  • the data classification information in the data classification list is counted in the form of a Cartesian product to generate a pivot table.
  • the processor 1001 may invoke the database-based Pivot application stored in the memory 1005, and further perform the following operations:
  • the processor 1001 may invoke the database-based Pivot application stored in the memory 1005, and further perform the following operations:
  • an export prompt message is displayed to prompt the user to select an export format
  • PivotTable exports the PivotTable based on the user-selected export format.
  • the database-based pivoting method includes:
  • Step S10 when a database-based pivot request is detected, a pivot setting window is displayed to prompt the user to set the perspective parameter.
  • the Pivot parameter setting window will be displayed on the display interface of the database, prompting the user to set the corresponding Pivot parameter, the data set by the user.
  • the perspective parameters include the perspective dimension parameters of the pivot (perspective dimension parameters: row labels that can be understood as data information in the database, or header information of the data tables in the database, for example, the data information saved in the database is the user's personal consumption information, then Perspective dimension parameters are: user name, age, gender, address, birthday, contact information, purchase of products and other consumption records, etc.) and perspective range parameters (perspective scope parameters: the range of perspective data in the database, the user can set the perspective The data range, that is, the user can set the new data information in the database for the perspective data range of the perspective), in conjunction with FIG. 7, FIG. 7 is a schematic diagram of the interface in which the user sets different parameters during the data pivoting process, in which the user can Set month, company, etc. As a perspective dimension parameter information to obtain desired perspective.
  • perspective dimension parameters row labels that can be understood as data information in the database, or header information of the data tables in the database, for example, the data information saved in the database is the user's personal consumption information, then Perspective dimension parameters are:
  • Step S20 when it is detected that the setting of the perspective parameter is completed, determining the pivot range according to the perspective range parameter in the perspective parameter, and acquiring data information in the in-vivo data perspective range.
  • the user can click the “confirm” button to determine the data range (or the amount of data pivot) that the user needs to see based on the perspective range parameter set by the user.
  • the database is a marketing database
  • the perspective is set according to the user.
  • the scope parameter determines the range of data information in the in-memory marketing database that needs to be pivoted, and obtains the data information in the in-vivo perspective to perform the perspective of the data information.
  • the data information in the database is pre-cached into the memory in the present invention, and the data information is perspectived, but in actual cases, according to the amount of data information in the database, if the amount of data information is large, the data information may be Pre-cached into the memory, if the data information is small, the data information can be cached into the memory during the pivot, which does not affect the scope of protection of the present invention).
  • step S30 the data information in the Pivot range is pivoted and a PivotTable is generated.
  • Pivoting the data information in the obtained perspective range specifically, classifying the data information in the data range according to the perspective dimension in the perspective parameter, and performing the Cartesian product on the classified data information to generate the pivot table.
  • the existing database is sales data for various regions of the country. Users set the perspective for the number of female consumers aged 20-30 in North China in the first quarter of 2017. According to the dimension set by time, the first selected data range is 2017.
  • the sales data information in the first quarter and then determine the perspective dimension: North China, women, age 20-30 years old, using Cartesian product (dimensions without prioritization) to obtain perspective, obtain sales in North China, and then sell from North China Looking for female consumers, and finally looking for data from 20-30 years old among female consumers in North China (additional explanation is: adjust the order of data dimensions, the results of perspective using Cartesian product are the same, that is, first look up Female consumers, re-determine the North China region, and finally determine the perspective data obtained from the age of 20-30 is the same)
  • the data sheet/table of the number of female consumers aged 20-30 in North China was formed in the first quarter of 2017.
  • Pivot has different modes, that is, users can select only one Pivot dimension parameter.
  • users can set a dimension of the region, and perform statistical classification and summary of marketing data in each region to form a regional marketing data perspective.
  • the user can also select multiple perspective dimension parameters, and the terminal classifies the data information in the database according to multiple perspective dimension parameters set by the user, and generates a data pivot table (perspective view), thereby simultaneously, the user
  • the marketing database can be based on the needs of the users, and the user (marketer) can market specific consumers for specific regions and consumers of specific ages. For the product, the user can set the priority of the perspective dimension parameter, and correspondingly obtain the perspective data that meets the user's needs.
  • FIG. 7 is a method of using time-for-space in the data see-through process, and loading the full amount of data information: the client and the label into the memory in advance, whether during the user's use, whether it is the previous screening or the later perspective.
  • the perspective dimension parameters are all based on the data in the memory. After filtering out the categories corresponding to the perspective dimension parameters, multiple dimensions are selected for perspective.
  • the system adopts a parallel operation strategy, and filters on each dimension to view the The distribution of all values in the dimension (such as male, female or landline, mobile phone, or 2014, 2015, etc.), the Cartesian product of all the optional values of the field, as the screening criteria for data group statistics, the statistics of the perspective results Distribute and generate a pivot table.
  • the data information in the database is pre-imported into the computer memory, and all the data amount is cached into the memory to prevent the database information from being jammed, and the data processing efficiency is accelerated, and the user performs the database data information perspective according to the user.
  • the selected PivotScope perspectives the data information in the database and forms a PivotTable.
  • the user does not need to export the data information in the database to Excel for pivoting, which avoids the amount of Pivot in Pivo in Excel.
  • step S20 includes:
  • Step S21 when it is detected that the perspective parameter setting is completed, the set perspective parameter is obtained to determine whether the perspective parameter is included in the perspective parameter.
  • the Pivot parameter set by the user is obtained (the Pivot parameter is mainly a perspective range parameter and a perspective dimension parameter), and it is determined whether the perspective parameter includes a perspective range parameter, that is, the user may not set the perspective range.
  • the terminal database defaults to the perspective of all data information. The user must set the dimension of the pivot when he is in Pivot. It needs to be added that the user needs to set the corresponding row label, column label and other information when setting the multi-dimensional dimension parameter.
  • Step S22 if the perspective parameter includes a perspective range parameter, the pivot range is determined according to the perspective range parameter, and the data information in the in-vivo data perspective range is obtained.
  • the range of the perspective data is determined according to the pivot range parameter set by the user, and the data information of the corresponding data range in the memory is obtained, so that the data information is perspectived according to the data range set by the user.
  • step S23 if the perspective parameter is not included in the perspective parameter, all data information stored in the database in the memory is acquired to perform full-scale data pivoting.
  • the user sets the perspective dimension parameter but does not set the perspective range parameter, then all the data information in the database is subjected to the perspective of the data information according to the perspective dimension parameter, that is, the set perspective dimension parameter is obtained, and the database is All the data information in the category is classified according to the perspective dimension, and correspondingly the full amount of the pivot table is obtained.
  • the data view can be selected according to the data information selected in the user setting database, thereby improving the efficiency of the data perspective, making the data perspective more convenient, and the user can directly select the pivot range in the database, thereby avoiding the user.
  • the troublesome operation of exporting data information in Excel perspective improves the user experience, and at the same time, the user can fully view all the data information in the in-memory database when the user does not set the perspective range, which can improve the efficiency of the data and avoid the appearance of the data perspective.
  • step S30 includes:
  • Step S31 classifying the data information in the Pivot range according to the perspective dimension parameter in the perspective parameter to obtain a data classification list.
  • the data information in the Pivot range is classified according to the perspective dimension parameters set by the user, and a classification list corresponding to the data dimension is formed, and the user can change the classification list by changing the dimension corresponding to form different PivotTables (PivotChart).
  • step S32 the data classification information in the data classification list is counted to generate a pivot table.
  • the data information in the data classification list is statistically summarized. Specifically, the statistical summary of the data information may be performed according to the Cartesian product (Cartesian product: the intersection of the data information in the classification list of each data dimension) to form a corresponding data.
  • Cartesian product Cartesian product: the intersection of the data information in the classification list of each data dimension
  • the pivot table as shown in Figure 8, for example, the marketing target group is Shaanxi, the customer from the traditional channel to the new channel sales and the insurance expires in May; in the large database, according to these dimensions, the customer is extracted Marketing, but before doing marketing, you need to view the distribution of the customer groups that need to be marketed.
  • the original data in the database is the order of the stores in each region. If the user selects a data dimension of the store as the perspective dimension parameter and obtains the sales perspective of the store, the corresponding text description information is obtained: the sales amount of the store quarter is xxx yuan. If the user selects the two data dimensions of the region and the product as the perspective dimension parameters and obtains the sales perspective table of each product in each region, the corresponding text description information is obtained: the sales volume of the xx product of the xx region is xx, and the same user can increase the last year. The same period of data, the corresponding rate of change.
  • the specific data perspective is described, and the corresponding PivotTable is formed by classifying and summarizing the data of the perspective dimension parameters set by the user, and when the user changes the Pivot dimension parameter, the corresponding PivotTable list can be obtained.
  • the perspective does not require the user's cumbersome operation, the process of the perspective is simple and straightforward, and the simple result description of the perspective result can be performed according to the pivot table, so that some users lacking the data analysis experience directly obtain the corresponding data perspective result.
  • the database-based pivoting method further includes:
  • step S50 when the PivotTable-based export request is detected, the export prompt information is displayed to prompt the user to select the export format.
  • the corresponding data format appears in the database for the user to select, for example: “.xls”, “.xlsx”, “.xml”, etc.; the user can select the export format or select the amount of data to be exported. For information, as shown in Figure 9, users can set different export dimensions and export formats.
  • step S60 the pivot table is used to export the pivot table according to the user selected export format.
  • the user-selected pivot amount is exported in the selected PivotTable format.
  • the derivation of the pivot table can reduce the amount of data exported, improve the efficiency of exporting, increase the export format of the data set or the amount of information exported, and the user can select Different perspective dimension parameters are used for the perspective data export.
  • the data pivot information is exported according to the user's requirements, thereby improving the user experience.
  • the present invention provides a database-based pivoting device.
  • the database-based pivoting device includes:
  • the parameter setting module 10 is configured to display a pivot setting window to prompt the user to set the perspective parameter when the database-based pivot request is detected.
  • the terminal parameter setting module 10 detects that the user browses the database, the user clicks the Pivot button on the database to trigger the Pivot request, and the Pivot parameter setting window is displayed on the display interface of the database, prompting the user to set the corresponding Pivot parameter.
  • the pivot parameters set by the user include the perspective dimension parameters of the pivot (perspective dimension parameters: row labels that can be understood as data information in the database, or header information of the data tables in the database, for example, the data information saved in the database is the user's personal
  • the perspective dimension parameters are: user name, age, gender, address, birthday, contact information, purchase product and other consumption records, etc.
  • perspective range parameters perspective scope parameter: the range of perspective data in the database, the user can Set the data range that needs perspective, that is, the user can set the new data information in the database to be the perspective data range of the perspective.
  • FIG. 7 is a schematic diagram of the interface for setting different parameters by the user during the data pivoting process. The user can set In the month, the company and other information are used as perspective dimension parameters to get the required perspective.
  • the perspective acquisition module 20 is configured to, when detecting the completion of the perspective parameter setting, the perspective acquisition module 20 determine the pivot range according to the perspective range parameter in the perspective parameter, and obtain data information in the in-vivo data perspective range.
  • the user can click the “confirm” button, and the perspective acquisition module 20 determines the data range (or the amount of data pivot) that the user needs to see according to the perspective range parameter set by the user.
  • the database is a marketing database, according to The perspective range parameter set by the user determines the range of data information in the in-memory marketing database that needs to be perspectived, and obtains the data information in the in-vivo pivot range for the perspective of the data information.
  • the data information in the database is pre-cached into the memory in the present invention, and the data information is perspectived, but in actual cases, according to the amount of data information in the database, if the amount of data information is large, the data information may be Pre-cached into the memory, if the data information is small, the data information can be cached into the memory during the pivot, which does not affect the scope of protection of the present invention).
  • the perspective generation module 30 is configured to perform data pivoting on data information within a pivot range and generate a pivot table.
  • the perspective generation module 30 performs perspective on the acquired data information in the perspective range. Specifically, the data information in the data range is classified according to the perspective dimension in the perspective parameter, and the classified data information is made into a Cartesian product. Generate a PivotTable. For example, the existing database is sales data for each region of the country. The user sets the perspective for the number of female consumers aged 20-30 in North China in the first quarter of 2017. According to the dimension set by time, the data selected first.
  • the scope is the sales data information for the first quarter of 2017, and then the perspective dimension: North China, women, ages 20-30, using Cartesian product (dimensions regardless of priority) to obtain sales, obtain sales in North China, and then Find female consumers from the sales in North China, and finally find the data of 20-30 years old among female consumers in North China.
  • Cartesian product dimensions regardless of priority
  • find female consumers from the sales in North China and finally find the data of 20-30 years old among female consumers in North China.
  • Additional explanation is: adjust the order of data dimensions, and use the Cartesian product to see the same result. That is, first look for female consumers, then determine the North China region, and finally determine the perspective of 20-30 years old. It is the same) eventually formed the first quarter of 2017, PivotChart number of 20-30 year old female consumers in North China / table.
  • Pivot has different modes, that is, users can select only one Pivot dimension parameter.
  • users can set a dimension of the region, and perform statistical classification and summary of marketing data in each region to form a regional marketing data perspective.
  • the user can also select multiple perspective dimension parameters, and the terminal classifies the data information in the database according to multiple perspective dimension parameters set by the user, and generates a data pivot table (perspective view), thereby simultaneously, the user
  • the marketing database can be based on the needs of the users, and the user (marketer) can market specific consumers for specific regions and consumers of specific ages. For the product, the user can set the priority of the perspective dimension parameter, and correspondingly obtain the perspective data that meets the user's needs.
  • FIG. 7 is a method of using time-for-space in the data see-through process, and loading the full amount of data information: the client and the label into the memory in advance, whether during the user's use, whether it is the previous screening or the later perspective.
  • the perspective dimension parameters are all based on the data in the memory. After filtering out the categories corresponding to the perspective dimension parameters, multiple dimensions are selected for perspective.
  • the system adopts a parallel operation strategy, and filters on each dimension to view the The distribution of all values in the dimension (such as male, female or landline, mobile phone, or 2014, 2015, etc.), the Cartesian product of all the optional values of the field, as the screening criteria for data group statistics, the statistics of the perspective results Distribute and generate a pivot table.
  • the data information in the database is pre-imported into the computer memory, and all the data amount is cached into the memory to prevent the database information from being jammed, and the data processing efficiency is accelerated, and the user performs the database data information perspective according to the user.
  • the selected PivotScope perspectives the data information in the database and forms a PivotTable.
  • the user does not need to export the data information in the database to Excel for pivoting, which avoids the amount of Pivot in Pivo in Excel.
  • an embodiment of the present invention further provides a computer storage medium.
  • the computer storage medium stores a database-based pivoting program, the step of implementing the database-based pivoting method when the database-based pivoting program is executed by the processor.
  • the method implemented when the database-based data pivoting program is executed may refer to various embodiments of the database-based data pivoting method of the present invention, and details are not described herein again.
  • portions of the technical solution of the present invention that contribute substantially or to the prior art may be embodied in the form of a software product stored in a storage medium (such as a ROM/RAM as described above). , a disk, an optical disk, including a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
  • a terminal device which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明公开了一种基于数据库的数据透视方法,包括以下步骤:当检测到基于数据库的数据透视请求时,显示数据透视设置窗口,以提示用户设置透视参数;当检测到透视参数设置完成时,根据透视参数中透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息;将数据透视范围内的数据信息进行数据透视,并生成数据透视表。本发明还公开了一种基于数据库的数据透视装置和计算机存储介质。本发明旨在通过对数据库的功能拓展,以提高数据库中的数据信息透视的效率,增加数据透视的便捷性。

Description

基于数据库的数据透视方法、装置和计算机存储介质
本申请要求于2017年8月17日提交中国专利局、申请号为201710709734.0、发明名称为“基于数据库的数据透视方法、装置和计算机存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本发明涉及数据处理领域,尤其涉及基于数据库的数据透视方法、装置和计算机存储介质。
背景技术
随着大数据时代的到来,数据量越来越大导致了数据的管理或者有效数据提取等方面较为麻烦。
现有的数据库主要围绕数据存储,在数据管理与数据维护方面还有待提高,现有的数据库不具有数据透视的功能,用户进行数据透视时需要将数据导出至Excel中,用户使用Excel的数据透视表功能对数据进行透视,这样的方法处理数据的数据量较小,数据处理过程较麻烦,对一些Excel表格数据透视功能不熟悉的用户,对数据库中的数据进行透视处理就会变得尤为困难,同时使用Excel数据透视功能进行数据透视的时间较长,数据处理量较少,还可能会出现数据Excel数据处理表中公式等的应用导致计算机卡顿,影响其他程序的运行等问题。
上述内容仅用于辅助理解本发明的技术方案,并不代表承认上述内容是现有技术。
发明内容
本发明的主要目的在于提供一种基于数据库的数据透视方法、装置和计算机存储介质,旨在通过对数据库的功能拓展,以提高数据库中的数据信息透视的效率,增加数据透视的便捷性。
为实现上述目的,本发明提供一种基于数据库的数据透视方法,所述基于数据库的数据透视包括以下步骤:
当检测到基于数据库的数据透视请求时,显示数据透视设置窗口,以提示用户设置透视参数;
当检测到透视参数设置完成时,根据透视参数中透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息;
将数据透视范围内的数据信息进行数据透视,并生成数据透视表。
可选地,所述当检测到透视参数设置完成时,根据透视参数中透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息的步骤包括:
当检测到透视参数设置完成时,获取设置的透视参数,以判断透视参数中是否包含透视范围参数;
若透视参数中包含透视范围参数,则根据透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息。
可选地,所述当检测到透视参数设置完成时,获取设置的透视参数,以判断透视参数中是否包含透视范围参数的步骤之后包括:
若透视参数中不包含透视范围参数,则获取存储于内存中数据库的全部数据信息,以进行全量数据透视。
可选地,所述则将数据透视范围内的数据信息进行数据透视,并生成数据透视表的步骤包括:
将数据透视范围内的数据信息按透视参数中的透视维度参数分类,以得到数据分类列表;
将数据分类列表中的数据分类信息统计,生成数据透视表。
可选地,所述将数据分类列表中的数据分类信息统计,生成数据透视表的步骤包括:
将数据分类列表中的数据分类信息按笛卡尔积的形式进行统计,生成数据透视表。
可选地,所述将数据透视范围内的数据信息进行数据透视,并生成数据透视表的步骤之后包括:
当检测到基于数据透视表的分析请求时,对数据透视表中各个维度的透视数据进行汇总,并生成对应的文字描述。
可选地,所述将数据透视范围内的数据信息进行数据透视,并生成数据透视表的步骤之后还包括:
当检测到基于数据透视表的导出请求时,显示导出提示信息,以提示用户选择导出格式;
将数据透视表根据用户选择导出格式进行透视表的导出。
为实现上述目的,本发明还提供一种基于数据库的数据透视装置,所述基于数据库的数据透视装置包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的基于数据库的数据透视程序,其中:
所述基于数据库的数据透视程序被所述处理器执行时实现如基于数据库的数据透视方法的步骤:
当检测到基于数据库的数据透视请求时,显示数据透视设置窗口,以提示用户设置透视参数;
当检测到透视参数设置完成时,根据透视参数中透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息;
将数据透视范围内的数据信息进行数据透视,并生成数据透视表。
可选地,所述则将数据透视范围内的数据信息进行数据透视,并生成数据透视表的步骤包括:
将数据透视范围内的数据信息按透视参数中的透视维度参数分类,以得到数据分类列表;
将数据分类列表中的数据分类信息统计,生成数据透视表。
此外,为实现上述目的,本发明还提供一种计算机存储介质,所述计算机存储介质上存储有基于数据库的数据透视程序,所述基于数据库的数据透视程序被处理器执行时实现如上述的基于数据库的数据透视方法的步骤。
本发明实施例提出的一种基于数据库的数据透视方法包括以下步骤:当检测到基于数据库的数据透视请求时,显示数据透视设置窗口,以提示用户设置透视参数;当检测到透视参数设置完成时,根据透视参数中透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息;将数据透视范围内的数据信息进行数据透视,并生成数据透视表。将数据库中的数据信息预先导入到计算机内存中,将全部数据量缓存至内存中可以防止数据库信息卡顿,加快数据的处理效率,在用户进行数据库数据信息透视时,根据用户选择的数据透视范围对数据库中的数据信息进行透视,并形成数据透视表,用户无需将数据库中的数据信息进行导出至Excel中进行数据透视,避免了Excel中数据透视出现的数据透视量不大,用户操作麻烦等问题,实现了数据库中数据信息方便、快捷、高效的数据透视。
附图说明
图1是本发明实施例方案涉及的硬件运行环境的装置结构示意图;
图2为本发明基于数据库的数据透视方法一实施例的流程示意图;
图3为图2中基于数据库的数据透视方法的步骤S20的细化流程示意图;
图4为图2中基于数据库的数据透视方法的步骤S30的细化流程示意图;
图5为本发明基于数据库的数据透视方法另一实施例的流程示意图;
图6为本发明基于数据库的数据透视装置一实施例的功能模块示意图;
图7为本发明基于数据库的数据透视参数设置界面示意图;
图8为本发明基于数据库的数据透视各个实施例结合的具体场景示意图;
图9为本发明基于数据库的数据透视导出的场景示意图。
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
现有的数据信息增长量大,现有的绝大多数数据库中只用于的数据信息的存储,而数据的管理维护大多依赖数据维护人员,用户登录数据库进行数据查看时,若有数据使用上的需求,需要将数据库中的数据信息进行导出,再利用其它的数据处理工具进行数据的计算,从而将数据库中存储的数据信息利用到营销活动中。
本发明实施例的主要解决方案是:在数据库上增加新的功能,首先存储在计算机硬盘中的数据库的数据信息缓存至计算机内存中(将全部数据量缓存至内存中可以防止数据库信息卡顿,加快数据的处理效率),用户无需将数据库中的数据信息进行导出,直接在数据库中进行数据信息的透视,当检测到用户触发数据透视请求时,根据用户设置的数据透视参数对数据库中的数据信息进行透视,并将数据透视的结果进行输出显示。
本发明提供一种解决方案,使数据库中增加数据透视功能,用户可以在数据库中进行数据透视,部分不懂Excel数据处理操作的用户,可以利用数据库的数据透视功能提高营销活动的效率。
如图1所示,图1是本发明实施例方案涉及的硬件运行环境的终端结构示意图。
本发明实施例终端可以是PC,也可以是智能手机、平板电脑、便携计算机等具有显示功能的可移动式终端设备,需要补充说明的是本发明中的基于数据库的数据透视装置可以是终端的组成部件也可以单独进行数据程序的运行,同时考虑到数据库存储量的问题,可将所述基于数据库的数据透视装置设置于服务器上,用户在终端上访问服务器,服务器中的基于数据库的数据透视装置根据终端的指令进行数据信息的透视,并将数据透视的透视表发送至终端上。
如图1所示,该终端可以包括:处理器1001,例如CPU,网络接口1004,用户接口1003,存储器1005,通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。
可选地,终端还可以包括摄像头、RF(Radio Frequency,射频)电路,传感器、音频电路、WiFi模块等等。其中,传感器比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示屏的亮度,接近传感器可在移动终端移动到耳边时,关闭显示屏和/或背光。作为运动传感器的一种,重力加速度传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别移动终端姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;当然,移动终端还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。
本领域技术人员可以理解,图1中示出的终端结构并不构成对终端的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图1所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及基于数据库的数据透视应用程序。
在图1所示的终端中,网络接口1004主要用于连接后台服务器,与后台服务器进行数据通信;用户接口1003主要用于连接客户端(用户端),与客户端进行数据通信;而处理器1001可以用于调用存储器1005中存储的基于数据库的数据透视应用程序,并执行以下操作:
当检测到基于数据库的数据透视请求时,显示数据透视设置窗口,以提示用户设置透视参数;
当检测到透视参数设置完成时,根据透视参数中透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息;
将数据透视范围内的数据信息进行数据透视,并生成数据透视表。
进一步地,处理器1001可以调用存储器1005中存储的基于数据库的数据透视应用程序,所述当检测到透视参数设置完成时,根据透视参数中透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息还执行以下操作:
当检测到透视参数设置完成时,获取设置的透视参数,以判断透视参数中是否包含透视范围参数;
若透视参数中包含透视范围参数,则根据透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息。
进一步地,所述当检测到透视参数设置完成时,获取设置的透视参数,以判断透视参数中是否包含透视范围参数的步骤之后,处理器1001可以调用存储器1005中存储的基于数据库的数据透视应用程序,还执行以下操作:
若透视参数中不包含透视范围参数,则获取存储于内存中数据库的全部数据信息,以进行全量数据透视。
进一步地,处理器1001可以调用存储器1005中存储的基于数据库的数据透视应用程序,所述则将数据透视范围内的数据信息进行数据透视,并生成数据透视表还执行以下操作:
将数据透视范围内的数据信息按透视参数中的透视维度参数分类,以得到数据分类列表;
将数据分类列表中的数据分类信息统计,生成数据透视表。
进一步地,处理器1001可以调用存储器1005中存储的基于数据库的数据透视应用程序,所述将数据分类列表中的数据分类信息统计,生成数据透视表还执行以下操作:
将数据分类列表中的数据分类信息按笛卡尔积的形式进行统计,生成数据透视表。
进一步地,所述将数据透视范围内的数据信息进行数据透视,并生成数据透视表的步骤之后,处理器1001可以调用存储器1005中存储的基于数据库的数据透视应用程序,还执行以下操作:
当检测到基于数据透视表的分析请求时,对数据透视表中各个维度的透视数据进行汇总,并生成对应的文字描述。
进一步地,所述将数据透视范围内的数据信息进行数据透视,并生成数据透视表的步骤之后,处理器1001可以调用存储器1005中存储的基于数据库的数据透视应用程序,还执行以下操作:
当检测到基于数据透视表的导出请求时,显示导出提示信息,以提示用户选择导出格式;
将数据透视表根据用户选择导出格式进行透视表的导出。
参照图2,在本发明基于数据库的数据透视方法一实施例中,所述基于数据库的数据透视方法包括:
步骤S10,当检测到基于数据库的数据透视请求时,显示数据透视设置窗口,以提示用户设置透视参数。
在终端检测到用户浏览数据库时,用户点击数据库上数据透视的按钮触发数据透视请求后,数据库的显示界面上将会显示数据透视参数设置窗口,提示用户设置相应的数据透视参数,用户设置的数据透视参数包括数据透视的透视维度参数(透视维度参数:可理解为数据库中数据信息的行标签,或数据库中数据表的表头信息,例如,数据库中保存的数据信息为用户个人消费信息,则透视维度参数为:用户姓名、年龄、性别、住址、生日、联系方式、购买产品及其他消费记录等)和透视范围参数(透视范围参数:数据库中需要透视数据的范围,用户可以设置需要透视的数据范围,即,用户可设置数据库中新增的数据信息为本次透视的透视数据范围),结合图7,图7是数据透视过程中用户设置不同的参数的界面示意图,图示中用户可以设置月份,公司等信息作为透视维度参数以得到需要的透视图。
步骤S20,当检测到透视参数设置完成时,根据透视参数中透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息。
用户设置完透视参数后用户可以点击“确认”按钮,根据用户设置的透视范围参数确定用户需要透视的数据范围(或者是又叫数据透视量),例如,数据库为营销数据库,根据用户设置的透视范围参数确定内存中营销数据库中的需要透视的数据信息的范围,并获取内存中数据透视范围内的数据信息,以进行数据信息的透视。(需要补充说明的是本发明中将数据库中的数据信息预先缓存至内存中,进行数据信息的透视,但是实际情况中可根据数据库中数据信息量的多少,若数据信息量大可将数据信息预先缓存至内存中,若数据信息较小可以在数据透视时,将数据信息缓存至内存中,这并不影响本发明的保护范围)。
步骤S30,将数据透视范围内的数据信息进行数据透视,并生成数据透视表。
将获取到的透视范围内的数据信息进行透视,具体地,将数据范围内的数据信息按照透视参数中的透视维度进行分类,并将分类后的数据信息做笛卡尔积,以生成数据透视表,例如,现有的数据库为全国各地区的销售数据,用户设置透视2017年第一季度,华北地区20-30岁女性消费者的数量,根据用时设置的维度,首先选择的数据范围为2017年第一季度的销售数据信息,再确定透视维度:华北地区、女性、年龄20-30岁,利用笛卡尔积的方式(维度不分优先级)进行透视,获取华北地区销量,再从华北地区销量中查找女性消费者,最后查找华北地区女性消费者中20-30岁的数据(需要补充说明的是:调整数据维度的先后顺序,利用笛卡尔积进行透视的结果是相同的,即,首先查找女性消费者、再确定华北地区,最后确定年龄为20-30岁得到的透视数据是相同的)最终形成2017年第一季度,华北地区20-30岁女性消费者的数量的数据透视图/表。
数据透视有不同的模式,即,用户可以只选择一个数据透视维度参数,例如,全国各地营销数据信息,用户可以设置地区一个维度,进行各个地区营销数据的分类统计汇总,形成地区营销数据透视图,用户还可以选择多个透视维度参数,终端将数据库中的数据信息按照用户设置的多个透视维度参数,进行数据信息的分类,并对应生成数据透视表(透视图),以此同时,用户利用数据库进行数据透视时,用户可以不用懂数据处理流程只需要根据使用需求设置维度,营销数据库可根据透视用户的需求,用户(营销人员)可以针对特定地区、特定年龄段的消费人群推销特定的产品,用户可自行设置透视维度参数的优先级,对应得到满足用户需要的透视数据。
结合图7,图7是数据透视过程中采用通过时间换空间的思路,提前把全量数据信息:客户及标签加载到内存中,在用户使用过程中无论是前期的筛选,还是后期透视时使用的透视维度参数,都是基于内存中的数据进行操作,当筛选出透视维度参数对应的类别后,选择多个维度进行透视,系统采用并行操作的策略,在每个维度基础上进行筛选,查看该维度上所有取值的分布(如男、女或者座机、手机、或者2014、2015年等),进行字段所有可选值的笛卡尔积,作为筛选条件进行数据分组统计,得出透视结果的统计分布,并生成数据透视表。
在本实施例中将数据库中的数据信息预先导入到计算机内存中,将全部数据量缓存至内存中可以防止数据库信息卡顿,加快数据的处理效率,在用户进行数据库数据信息透视时,根据用户选择的数据透视范围对数据库中的数据信息进行透视,并形成数据透视表,用户无需将数据库中的数据信息进行导出至Excel中进行数据透视,避免了Excel中数据透视出现的数据透视量不大,用户操作麻烦等问题,直接在数据库与利用Excel表格进行数据透视相比利用数据库进行数据透视容易操作,用户只需要在数据库中进行简单的数据透视的维度选择,无需将数据导出至Excel表格中,同时数据处理效率高,实现了数据库中的数据信息方便、快捷、高效的数据透视。
进一步的,参照图3,在本实施例中本发明基于数据库的数据透视方法中,步骤S20包括:
步骤S21,当检测到透视参数设置完成时,获取设置的透视参数,以判断透视参数中是否包含透视范围参数。
在终端检测到数据信息设置完成时,获取用户设置的数据透视参数(数据透视参数主要为透视范围参数和透视维度参数),判断透视参数中是否包含透视范围参数,即,用户可不设置透视范围,终端数据库默认为全部数据信息的透视,用户在数据透视时必须设置数据透视的维度;需要补充说明的是用户设置多数据透视维度参数时需要设置对应的行标签、列标签等信息。
步骤S22,若透视参数中包含透视范围参数,则根据透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息。
用户设置了数据透视的范围参数,则根据用户设置的数据透视范围参数确定透视数据的范围,获取内存中相应的数据范围的数据信息,以根据用户设置的数据范围对数据信息进行透视。
步骤S23,若透视参数中不包含透视范围参数,则获取存储于内存中数据库的全部数据信息,以进行全量数据透视。
在用户数据透视过程中,用户设置了透视维度参数但是没有设置的透视范围参数,则将数据库中的全部数据信息按照透视维度参数进行数据信息的透视,即,获取设置的透视维度参数,将数据库中的全部数据信息按照透视维度进行分类,并对应得到全量数据透视表。
在本实施例中对可根据用户设置数据库中选择相应数据范围的数据信息进行数据透视,提高了数据透视的效率,使得数据透视更加便捷,用户可以直接在数据库中选择数据透视范围,避免了用户将数据信息导出在Excel中透视的麻烦操作,提高了用户的体验,同时在用户没有设置透视范围时将内存中数据库中的全部数据信息进行全量透视,可以提高数据透视效率,避免了数据透视出现的数据导出等的操作,同时保证了数据库中大量数据的透视效率,将内存中的数据信息直接进行数据透视,有效避免了现在Excel表格数据透视的出现的透视数据量较少、卡顿等现象。
进一步的,参照图4,在本实施例中本发明基于数据库的数据透视方法中,步骤S30包括:
步骤S31,将数据透视范围内的数据信息按透视参数中的透视维度参数分类,以得到数据分类列表。
将数据透视范围内的数据信息按照用户设置的透视维度参数进行分类,形成对应数据维度的分类列表,用户可通过更改维度对应更改分类列表,形成不同的数据透视表(数据透视图)。
步骤S32,将数据分类列表中的数据分类信息统计,生成数据透视表。
将数据分类列表中的数据信息进行统计汇总,具体地,可以按照笛卡尔积(笛卡尔积:各个数据维度的分类列表中数据信息的交集)的形式,进行数据信息的统计汇总,形成对应的数据透视表,如图8所示,比如,营销目标群体为陕西、从传统渠道转到新渠道销售以及保险为5月到期的客户;在大的数据库中按照这些维度,把客户提取出来进行营销,但是在做营销前,还需要对需要营销的客户群体分布情况进行查看,目标客户分布符合预期后,在页面中查看透视结果不方便,提供了更多的选择方案,比如我们还可以通过导出excel的方式进行查看,并结合图表的方式进行查看,另外,如果需要看这部分客户在所有可筛选维度下的分布情况,还可以通过导出全维度透视的方式来进行更为全面的核查。
当检测到基于数据透视表的分析请求时,对数据透视表中各个维度的透视数据进行汇总,并生成对应的文字描述。
例如,数据库中原始数据是各个地区门店的输单情况,若用户选择门店一个数据维度作为透视维度参数,得到门店的销售额透视表,则对应得到文字描述信息:门店季度的销售额是xxx元,若用户选择地区、产品两个数据维度作为透视维度参数,得到各个地区各类产品的销售额透视表,则对应得到文字描述信息:xx地区xx产品的销售量是xx,同样用户可以增加去年同期的数据透视,得到对应地变化率。
在本实施例对具体的数据透视进行了说明,通过对用户设置的透视维度参数进行数据的分类汇总形成相应的数据透视表,在用户更改数据透视维度参数时,可得到对应数据透视列表,数据透视无需用户繁琐的操作,透视的流程简单直接,同时可以根据数据透视表对透视结果进行简单的文字描述,使得一些缺乏数据分析经验的用户直接得到对应的数据透视结果。
参照图5,本发明一种基于数据库的数据透视方法的另一实施例,所述基于数据库的数据透视方法还包括:
步骤S50,当检测到基于数据透视表的导出请求时,显示导出提示信息,以提示用户选择导出格式。
在用户选择数据透视表导出时,数据库中对应出现相应的数据格式,以供用户选择,比如:“.xls”“.xlsx”“.xml”等等;用户可以选择导出格式或者选择导出数据量等信息,若图9所示,用户可设置不同的导出维度和导出格式。
步骤S60,将数据透视表根据用户选择导出格式进行透视表的导出。
在检测到用户设置导出完成时,将用户选择的数据透视量按选择的数据透视格式进行导出。
在本实施例中与数据库中原始数据信息的导出不同,数据透视表的导出可以减少导出的数据量,提高了导出的效率,增加设置了数据透视的导出格式或者导出的信息量,用户可以选择不同的透视维度参数进行透视数据导出,本实施例中将数据透视表按用户需求进行数据信息的导出,提高了用户的体验。
本发明提供一种基于数据库的数据透视装置,参照图6,本发明基于数据库的数据透视装置的一实施例中,所述基于数据库的数据透视装置包括:
参数设置模块10,用于当检测到基于数据库的数据透视请求时,显示数据透视设置窗口,以提示用户设置透视参数。
在终端参数设置模块10检测到用户浏览数据库时,用户点击数据库上数据透视的按钮触发数据透视请求后,数据库的显示界面上将会显示数据透视参数设置窗口,提示用户设置相应的数据透视参数,用户设置的数据透视参数包括数据透视的透视维度参数(透视维度参数:可理解为数据库中数据信息的行标签,或数据库中数据表的表头信息,例如,数据库中保存的数据信息为用户个人消费信息,则透视维度参数为:用户姓名、年龄、性别、住址、生日、联系方式、购买产品及其他消费记录等)和透视范围参数(透视范围参数:数据库中需要透视数据的范围,用户可以设置需要透视的数据范围,即,用户可设置数据库中新增的数据信息为本次透视的透视数据范围),结合图7,图7是数据透视过程中用户设置不同的参数的界面示意图,图示中用户可以设置月份,公司等信息作为透视维度参数以得到需要的透视图。
透视获取模块20,用于当检测到透视参数设置完成时,透视获取模块20根据透视参数中透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息。
用户设置完透视参数后用户可以点击“确认”按钮,透视获取模块20根据用户设置的透视范围参数确定用户需要透视的数据范围(或者是又叫数据透视量),例如,数据库为营销数据库,根据用户设置的透视范围参数确定内存中营销数据库中的需要透视的数据信息的范围,并获取内存中数据透视范围内的数据信息,以进行数据信息的透视。(需要补充说明的是本发明中将数据库中的数据信息预先缓存至内存中,进行数据信息的透视,但是实际情况中可根据数据库中数据信息量的多少,若数据信息量大可将数据信息预先缓存至内存中,若数据信息较小可以在数据透视时,将数据信息缓存至内存中,这并不影响本发明的保护范围)。
透视生成模块30,用于将数据透视范围内的数据信息进行数据透视,并生成数据透视表。
透视生成模块30将获取到的透视范围内的数据信息进行透视,具体地,将数据范围内的数据信息按照透视参数中的透视维度进行分类,并将分类后的数据信息做笛卡尔积,以生成数据透视表,例如,现有的数据库为全国各地区的销售数据,用户设置透视2017年第一季度,华北地区20-30岁女性消费者的数量,根据用时设置的维度,首先选择的数据范围为2017年第一季度的销售数据信息,再确定透视维度:华北地区、女性、年龄20-30岁,利用笛卡尔积的方式(维度不分优先级)进行透视,获取华北地区销量,再从华北地区销量中查找女性消费者,最后查找华北地区女性消费者中20-30岁的数据(需要补充说明的是:调整数据维度的先后顺序,利用笛卡尔积进行透视的结果是相同的,即,首先查找女性消费者、再确定华北地区,最后确定年龄为20-30岁得到的透视数据是相同的)最终形成2017年第一季度,华北地区20-30岁女性消费者的数量的数据透视图/表。
数据透视有不同的模式,即,用户可以只选择一个数据透视维度参数,例如,全国各地营销数据信息,用户可以设置地区一个维度,进行各个地区营销数据的分类统计汇总,形成地区营销数据透视图,用户还可以选择多个透视维度参数,终端将数据库中的数据信息按照用户设置的多个透视维度参数,进行数据信息的分类,并对应生成数据透视表(透视图),以此同时,用户利用数据库进行数据透视时,用户可以不用懂数据处理流程只需要根据使用需求设置维度,营销数据库可根据透视用户的需求,用户(营销人员)可以针对特定地区、特定年龄段的消费人群推销特定的产品,用户可自行设置透视维度参数的优先级,对应得到满足用户需要的透视数据。
结合图7,图7是数据透视过程中采用通过时间换空间的思路,提前把全量数据信息:客户及标签加载到内存中,在用户使用过程中无论是前期的筛选,还是后期透视时使用的透视维度参数,都是基于内存中的数据进行操作,当筛选出透视维度参数对应的类别后,选择多个维度进行透视,系统采用并行操作的策略,在每个维度基础上进行筛选,查看该维度上所有取值的分布(如男、女或者座机、手机、或者2014、2015年等),进行字段所有可选值的笛卡尔积,作为筛选条件进行数据分组统计,得出透视结果的统计分布,并生成数据透视表。
在本实施例中将数据库中的数据信息预先导入到计算机内存中,将全部数据量缓存至内存中可以防止数据库信息卡顿,加快数据的处理效率,在用户进行数据库数据信息透视时,根据用户选择的数据透视范围对数据库中的数据信息进行透视,并形成数据透视表,用户无需将数据库中的数据信息进行导出至Excel中进行数据透视,避免了Excel中数据透视出现的数据透视量不大,用户操作麻烦等问题,直接在数据库与利用Excel表格进行数据透视相比利用数据库进行数据透视容易操作,用户只需要在数据库中进行简单的数据透视的维度选择,无需将数据导出至Excel表格中,同时数据处理效率高,实现了数据库中的数据信息方便、快捷、高效的数据透视。
此外,本发明实施例还提出一种计算机存储介质。
所述计算机存储介质上存储有基于数据库的数据透视程序,所述基于数据库的数据透视程序被处理器执行时实现基于数据库的数据透视方法的步骤。
其中,基于数据库的数据透视程序被执行时所实现的方法可参照本发明基于数据库的数据透视方法的各个实施例,此处不再赘述。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本发明各个实施例所述的方法。
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。

Claims (21)

  1. 一种基于数据库的数据透视方法,其特征在于,所述基于数据库的数据透视方法包括以下步骤:
    当检测到基于数据库的数据透视请求时,显示数据透视设置窗口,以提示用户设置透视参数;
    当检测到透视参数设置完成时,根据透视参数中透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息;
    将数据透视范围内的数据信息进行数据透视,并生成数据透视表。
  2. 如权利要求1所述的基于数据库的数据透视方法,其特征在于,所述当检测到透视参数设置完成时,根据透视参数中透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息的步骤包括:
    当检测到透视参数设置完成时,获取设置的透视参数,以判断透视参数中是否包含透视范围参数;
    若透视参数中包含透视范围参数,则根据透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息。
  3. 如权利要求2所述的基于数据库的数据透视方法,其特征在于,所述当检测到透视参数设置完成时,获取设置的透视参数,以判断透视参数中是否包含透视范围参数的步骤之后包括:
    若透视参数中不包含透视范围参数,则获取存储于内存中数据库的全部数据信息,以进行全量数据透视。
  4. 如权利要求1所述的基于数据库的数据透视方法,其特征在于,所述则将数据透视范围内的数据信息进行数据透视,并生成数据透视表的步骤包括:
    将数据透视范围内的数据信息按透视参数中的透视维度参数分类,以得到数据分类列表;
    将数据分类列表中的数据分类信息统计,生成数据透视表。
  5. 如权利要求4所述的基于数据库的数据透视方法,其特征在于,所述将数据分类列表中的数据分类信息统计,生成数据透视表的步骤包括:
    将数据分类列表中的数据分类信息按笛卡尔积的形式进行统计,生成数据透视表。
  6. 如权利要求1所述的基于数据库的数据透视方法,其特征在于,所述将数据透视范围内的数据信息进行数据透视,并生成数据透视表的步骤之后包括:
    当检测到基于数据透视表的分析请求时,对数据透视表中各个维度的透视数据进行汇总,并生成对应的文字描述。
  7. 如权利要求1所述的基于数据库的数据透视方法,其特征在于,所述将数据透视范围内的数据信息进行数据透视,并生成数据透视表的步骤之后还包括:
    当检测到基于数据透视表的导出请求时,显示导出提示信息,以提示用户选择导出格式;
    将数据透视表根据用户选择导出格式进行透视表的导出。
  8. 一种基于数据库的数据透视装置,其特征在于,所述基于数据库的数据透视装置包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的基于数据库的数据透视程序,其中:
    所述基于数据库的数据透视程序被所述处理器执行时实现如基于数据库的数据透视方法的步骤:
    当检测到基于数据库的数据透视请求时,显示数据透视设置窗口,以提示用户设置透视参数;
    当检测到透视参数设置完成时,根据透视参数中透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息;
    将数据透视范围内的数据信息进行数据透视,并生成数据透视表。
  9. 如权利要求8所述的基于数据库的数据透视装置,其特征在于,所述当检测到透视参数设置完成时,根据透视参数中透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息的步骤包括:
    当检测到透视参数设置完成时,获取设置的透视参数,以判断透视参数中是否包含透视范围参数;
    若透视参数中包含透视范围参数,则根据透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息。
  10. 如权利要求9所述的基于数据库的数据透视装置,其特征在于,所述当检测到透视参数设置完成时,获取设置的透视参数,以判断透视参数中是否包含透视范围参数的步骤之后,包括:
    若透视参数中不包含透视范围参数,则获取存储于内存中数据库的全部数据信息,以进行全量数据透视。
  11. 如权利要求8所述的基于数据库的数据透视装置,其特征在于,所述则将数据透视范围内的数据信息进行数据透视,并生成数据透视表的步骤包括:
    将数据透视范围内的数据信息按透视参数中的透视维度参数分类,以得到数据分类列表;
    将数据分类列表中的数据分类信息统计,生成数据透视表。
  12. 如权利要求11所述的基于数据库的数据透视装置,其特征在于,所述将数据分类列表中的数据分类信息统计,生成数据透视表的步骤包括:
    将数据分类列表中的数据分类信息按笛卡尔积的形式进行统计,生成数据透视表。
  13. 如权利要求8所述的基于数据库的数据透视装置,其特征在于,所述将数据透视范围内的数据信息进行数据透视,并生成数据透视表的步骤之后,包括:
    当检测到基于数据透视表的分析请求时,对数据透视表中各个维度的透视数据进行汇总,并生成对应的文字描述。
  14. 如权利要求8所述的基于数据库的数据透视装置,其特征在于,所述将数据透视范围内的数据信息进行数据透视,并生成数据透视表的步骤之后,还包括:
    当检测到基于数据透视表的导出请求时,显示导出提示信息,以提示用户选择导出格式;
    将数据透视表根据用户选择导出格式进行透视表的导出。
  15. 一种计算机存储介质,其特征在于,所述计算机存储介质上存储有基于数据库的数据透视程序,所述基于数据库的数据透视程序被处理器执行时实现以下步骤。
    当检测到基于数据库的数据透视请求时,显示数据透视设置窗口,以提示用户设置透视参数;
    当检测到透视参数设置完成时,根据透视参数中透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息;
    将数据透视范围内的数据信息进行数据透视,并生成数据透视表。
  16. 如权利要求15所述的计算机存储介质,其特征在于,所述当检测到透视参数设置完成时,根据透视参数中透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息的步骤包括:
    当检测到透视参数设置完成时,获取设置的透视参数,以判断透视参数中是否包含透视范围参数;
    若透视参数中包含透视范围参数,则根据透视范围参数确定数据透视范围,并获取内存中数据透视范围内的数据信息。
  17. 如权利要求16所述的计算机存储介质,其特征在于,所述当检测到透视参数设置完成时,获取设置的透视参数,以判断透视参数中是否包含透视范围参数的步骤之后包括:
    若透视参数中不包含透视范围参数,则获取存储于内存中数据库的全部数据信息,以进行全量数据透视。
  18. 如权利要求15所述的计算机存储介质,其特征在于,所述则将数据透视范围内的数据信息进行数据透视,并生成数据透视表的步骤包括:
    将数据透视范围内的数据信息按透视参数中的透视维度参数分类,以得到数据分类列表;
    将数据分类列表中的数据分类信息统计,生成数据透视表。
  19. 如权利要求18所述的计算机存储介质,其特征在于,所述将数据分类列表中的数据分类信息统计,生成数据透视表的步骤包括:
    将数据分类列表中的数据分类信息按笛卡尔积的形式进行统计,生成数据透视表。
  20. 如权利要求15所述的计算机存储介质,其特征在于,所述将数据透视范围内的数据信息进行数据透视,并生成数据透视表的步骤之后,包括:
    当检测到基于数据透视表的分析请求时,对数据透视表中各个维度的透视数据进行汇总,并生成对应的文字描述。
  21. 如权利要求15所述的计算机存储介质,其特征在于,所述将数据透视范围内的数据信息进行数据透视,并生成数据透视表的步骤之后,还包括:
    当检测到基于数据透视表的导出请求时,显示导出提示信息,以提示用户选择导出格式;
    将数据透视表根据用户选择导出格式进行透视表的导出。
PCT/CN2017/103543 2017-08-17 2017-09-26 基于数据库的数据透视方法、装置和计算机存储介质 WO2019033511A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710709734.0A CN107562821A (zh) 2017-08-17 2017-08-17 基于数据库的数据透视方法、装置和计算机存储介质
CN201710709734.0 2017-08-17

Publications (1)

Publication Number Publication Date
WO2019033511A1 true WO2019033511A1 (zh) 2019-02-21

Family

ID=60976295

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/103543 WO2019033511A1 (zh) 2017-08-17 2017-09-26 基于数据库的数据透视方法、装置和计算机存储介质

Country Status (2)

Country Link
CN (1) CN107562821A (zh)
WO (1) WO2019033511A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109359280B (zh) * 2018-09-12 2023-12-05 深圳市卡牛科技有限公司 数据展示方法、装置、计算机设备和存储介质
CN111382382B (zh) * 2018-12-28 2023-12-01 深圳市优必选科技有限公司 数据的展示方法、装置、计算机设备和存储介质
CN112487012B (zh) * 2020-11-12 2022-05-27 苏州浪潮智能科技有限公司 一种基于数据筛选的部件参数获取方法及装置

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1684068A (zh) * 2004-04-14 2005-10-19 微软公司 目标变量的自动数据透视生成
CN103020031A (zh) * 2012-12-19 2013-04-03 珠海金山办公软件有限公司 一种智能更新数据透视表的方法及装置
US20160357813A1 (en) * 2012-06-13 2016-12-08 Oracle International Corporation Information retrieval and navigation using a semantic layer and dynamic objects

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8689137B2 (en) * 2005-09-07 2014-04-01 Microsoft Corporation Command user interface for displaying selectable functionality controls in a database application
CN105488045A (zh) * 2014-09-16 2016-04-13 中兴通讯股份有限公司 一种数据展现的方法及装置
CN105528400A (zh) * 2015-12-02 2016-04-27 浪潮通用软件有限公司 一种基于Web的多维分析系统及方法
CN105868310B (zh) * 2016-03-25 2020-05-26 联想(北京)有限公司 一种数据处理方法、装置及电子设备

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1684068A (zh) * 2004-04-14 2005-10-19 微软公司 目标变量的自动数据透视生成
US20160357813A1 (en) * 2012-06-13 2016-12-08 Oracle International Corporation Information retrieval and navigation using a semantic layer and dynamic objects
CN103020031A (zh) * 2012-12-19 2013-04-03 珠海金山办公软件有限公司 一种智能更新数据透视表的方法及装置

Also Published As

Publication number Publication date
CN107562821A (zh) 2018-01-09

Similar Documents

Publication Publication Date Title
WO2018113241A1 (zh) 页面展示方法、装置、服务器和存储介质
WO2012100605A1 (zh) 图片管理方法、移动终端及计算机存储介质
WO2017012437A1 (zh) 网页批注显示方法、装置及移动终端
WO2019037197A1 (zh) 主题分类器的训练方法、装置及计算机可读存储介质
WO2019037196A1 (zh) 任务分配方法、装置及计算机可读存储介质
WO2019033511A1 (zh) 基于数据库的数据透视方法、装置和计算机存储介质
WO2020224246A1 (zh) 基于区块链的数据管理方法、装置、设备和存储介质
WO2020034526A1 (zh) 保险录音的质检方法、装置、设备和计算机存储介质
WO2020215681A1 (zh) 指示信息生成方法、装置、终端及存储介质
WO2014119967A1 (en) Page search method and electronic device supporting the same
WO2020238081A1 (zh) 一种网络直播间导购方法及系统
WO2020107762A1 (zh) Ctr预估方法、装置及计算机可读存储介质
WO2020119384A1 (zh) 基于大数据分析的医保异常检测方法、装置、设备和介质
WO2012100607A1 (zh) 终端桌面处理系统、终端及服务器和方法
WO2021003956A1 (zh) 产品信息的管理方法、装置、设备及存储介质
WO2020113959A1 (zh) 医疗机构透析水平的考核方法、装置、设备及存储介质
WO2020233090A1 (zh) 基于h5页面的应用配置方法、装置、设备及存储介质
WO2018205423A1 (zh) 音频播放方法、终端及计算机可读存储介质
WO2020107761A1 (zh) 广告文案处理方法、装置、设备及计算机可读存储介质
US20200244759A1 (en) User behavior data processing method and device, and computer-readable storage medium
WO2013131434A1 (zh) 交互界面的展示控制方法及即时通信工具、计算机存储介质
WO2021051558A1 (zh) 基于知识图谱的问答方法、装置和存储介质
US20150149293A1 (en) Advertisement storage method and advertisement insertion method, device, and system
WO2016090775A1 (zh) 同步操作短信数据的方法及系统
WO2020107591A1 (zh) 重复投保限制方法、装置、设备及可读存储介质

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 01/10/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17921528

Country of ref document: EP

Kind code of ref document: A1