Method for inquiring and analyzing linkage rate based on MySql
Technical Field
The invention relates to the technical field of computer application, in particular to a method for inquiring and analyzing linkage rate based on MySql.
Background
In the field of sales, it is important for merchants to sell commodities with relevance, but the relevance defined by the merchants is different from the relevance understood by users, and wrong marketing is likely to be half the time. For a shopping center pursuing multi-business mixed consumption, the associated consumption is the core of the shopping center operation, and when the brand combination is fixed, the associated rate can be improved or not by increasing the unit price of customers.
Disclosure of Invention
Aiming at the technical problems in the related art, the invention provides a method for inquiring and analyzing the linkage rate based on MySql, which can overcome the defects of the prior art.
In order to achieve the technical purpose, the technical scheme of the invention is realized as follows:
a method for analyzing linkage rate based on MySql query comprises the following steps:
s1, the user enters the linkage rate analysis page, selects or inputs the order data parameter to be inquired, and creates and submits the self-defined task;
s2, receiving order data parameters of the custom task, transmitting the parameters to a background, and then, MySql executing the custom task;
s3, the MySql executes a user-defined task, firstly, the MySql creates a table 1, the table 1 reads order data, calculates the number of users who purchase each commodity, creates a table 2, the table 2 calculates the number of users who purchase a commodity I and a commodity II, the table 1 is left-associated with the table 2, filters out data in the table 2 with the same commodity, calculates the linkage rate at the same time, creates a table 3, and outputs the calculated linkage rate result to the table 3;
s4, creating a table 4 by the MySql, wherein the table 4 is used for storing the client type, associating the table 3 with the table 4, creating a table 5 by the MySql, and outputting the association rate to the table 5;
s5, after the MySql executes the user-defined task, saving the table 5 for obtaining the result of calculating the linkage rate into a database result table;
and S6, when the user inquires the task state and the task result, the user association rate analysis page returns the self-defined task execution result and state to the user according to the data of the database result table.
Further, the order data parameters to be inquired comprise input parameters, a time range, commodities to be analyzed, commodity order data, a linkage rate range, a recommendable people number range and a predicted success people number range.
Further, in step S3, when the user number of the purchased commodity is calculated in table 1 and table 2, it is necessary to perform deduplication in advance based on the unique identification ID of the user.
Further, in step S4, the client types include an important client and a common client, and when the important client outputs the association rate again, all the association rates are normally output, and the important client includes important data in approximately 90 days; when the common client outputs the linkage rate, only the linkage rate data with the linkage rate more than 10% is output, and the important data of nearly 90 days are not included.
Further, the user selects screening, exporting or directly selecting marketing according to the returned results.
The invention has the beneficial effects that: the linkage rate is analyzed through a complete and efficient mysql data table, and the linkage and relevance among various commodities can be more clearly seen from the aspect of specific data; two kinds of execution methods of one set of flow, laminating reality, high efficiency execution analysis task more, moreover, the inquiry scope is big, and the maximize supports inquiry yesterday data, more is favorable to customer analysis and marketing, and help the trade company rationally promote commodity, improve the sales volume.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a flowchart of a method for analyzing linkage rate based on MySql query according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention belong to the protection scope of the present invention, and for the convenience of understanding the above technical solutions of the present invention, the above technical solutions of the present invention are described in detail below by specific use modes.
As shown in fig. 1, according to the method for analyzing the linkage rate based on MySql query in the embodiment of the present invention, the implementation steps include: firstly, a user enters a linkage rate analysis page, selects or inputs order data parameters to be inquired, and creates and submits a custom task. The order data parameters to be inquired comprise input parameters, a time range, commodities to be analyzed, commodity order data, a linkage rate range, a recommendable people number range and a predicted success people number range.
And transmitting the received order data parameters of the custom task into a background, and then executing the custom task by MySql.
The MySql executes a user-defined task, firstly, the MySql creates a table 1, the table 1 reads order data, calculates the number of users purchased by each commodity, creates a table 2 by the MySql, calculates the number of users who purchased a commodity I and a commodity II at the same time by the table 2, the table 1 is left-associated with the table 2, filters out data in the table 2 with the same commodity, calculates the linkage rate at the same time, creates a table 3, and outputs the calculated linkage rate result to the table 3; when the number of users purchasing commodities is calculated in the tables 1 and 2, duplication removal needs to be performed in advance according to the unique identification ID of the users; MySql creates table 4, wherein table 4 is used for storing the client type and associating table 3 with table 4; the MySql creates a table 5 again, and the association rate is output to the table 5; the client types comprise key clients and common clients, when the key clients output the linkage rate again, all the linkage rates are normally output, and important data in nearly 90 days are contained (the calculation cycle is T +1, and the calculation is carried out by using the data in nearly 90 days before today); when the common client outputs the linkage rate, only the linkage rate data with the linkage rate more than 10% is output, and the important data of nearly 90 days are not included.
And after the MySql executes the custom task, saving the table 5 for obtaining the result of calculating the linkage rate into a database result table.
And when the user inquires the task state and the task result, the user association rate analysis page returns the user-defined task execution result and state to the user according to the data of the database result table, and the user selects screening, exporting or directly selects marketing according to the returned result.
In conclusion, by means of the technical scheme, the linkage rate is analyzed through the complete and efficient mysql data table, and the linkage and relevance among commodities can be more clearly seen from the aspect of specific data; two kinds of execution methods of one set of flow, more laminating reality, high efficiency execution analysis task, moreover, the inquiry scope is big, and the maximize supports inquiry yesterday data, more is favorable to customer analysis and marketing, and help the trade company rationally promote commodity, improve the sales volume, brings actual convenient experience effect for the user.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.