Data query method, and online course data query method and device
By introducing target fields into the data table and using their combined indexes, the problem of low query performance caused by the large number of combined index fields in the prior art is solved, and efficient query performance and distinction between project objects in different states is achieved.
Patent Information
- Application Number
- CN202311128153.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-04
- Publication Date
- 2025-03-04
AI Technical Summary
In the prior art, the number of fields contained in the composite index is large, especially the status fields containing Boolean type, which leads to low index utilization efficiency during query and reduces query performance.
By introducing a target field into the data table, the data table is constructed based on a combined index containing the participant information field and the target field, and when the project object is created, the value of the target field is set to a later time value than the creation time, and when the project object is finished, it is changed to the creation time, so as to achieve the distinction between in progress and ended states.
By reducing the number of fields in the combined index, the index utilization efficiency is improved, the overall query efficiency is improved, and the distinction between project objects in multiple different states and the order of creation time is realized.
Smart Images

Figure CN119557503A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data query method, an online course data query method, a device, an electronic device, and a machine-readable medium. Background Art
[0002] Online courses are a current way of learning. They are highly flexible and can meet students' needs to learn anytime and anywhere. One of the core functions of online courses is to provide a class list, which contains records of ongoing and completed online courses to help students understand the course situation.
[0003] At present, the classroom list service is implemented based on the online course data table in the database. The online course table can contain three core fields: status represents the course status, the value 1 represents ongoing, and the value 0 represents ended. start_time represents the start time of the course, uid represents the student ID, and the online course data table will establish corresponding data columns for these three fields, and the data columns have specific values of the fields. For the scenario of querying the online course data table, the query requirements include: displaying a student's course list by page according to uid, the ongoing courses are ranked before the ended courses, and the course start time is sorted in descending order. When querying specifically, you can build a structured query statement to query the online course data table based on the combined index of the above three fields arranged in order: idx(uid, status, start_time), and sort the queried data according to the value of the target field to obtain the query result.
[0004] However, the inventors have found through research that in the current solution, the combined index contains a large number of fields and there is a status field of Boolean type (valued as 1 or 0), which makes the index utilization efficiency low during query and reduces the query performance. Summary of the invention
[0005] The embodiments of the present application provide a data query method and an online course data query method to solve the problem in the related art that the index utilization efficiency is low during query, thereby reducing the query performance.
[0006] Correspondingly, the embodiment of the present application also provides a data query device and an online course data query device, an electronic device and a storage medium to ensure the implementation and application of the above method.
[0007] In order to solve the above problems, the present application discloses a data query method, which includes:
[0008] In response to a request to create a project object, a data table including values of the participant information field and the target field is constructed according to a combined index including a participant information field and a target field representing a time, and the value of the target field is set to a time value later than the creation time of the project object; the participant information field is used to represent information of participants who participate in the project object;
[0009] When the project object is ended, the value of the target field in the data table is changed to the creation time;
[0010] When a query request is obtained, the data table is queried according to the combined index and the query parameters included in the query request, and the queried data is sorted according to the value of the target field to obtain a query result.
[0011] The present application embodiment discloses an online course data query method, the method comprising:
[0012] In response to a request to create an online course, a data table including values of the student information field and the target field is constructed according to a combined index including a student information field and a target field representing a time, and the value of the target field is set to a time value later than the creation time of the online course; the student information field is used to represent information of students participating in the online course;
[0013] When the online course ends, the value of the target field in the data table is changed to the creation time;
[0014] When a query request is obtained, the data table is queried according to the combined index and the query parameters included in the query request, and the queried data is sorted according to the value of the target field to obtain a query result.
[0015] The present application discloses a data query device, which includes:
[0016] A construction module, configured to, in response to a request to create a project object, construct a data table including values of the participant information field and the target field according to a combined index including a participant information field and a target field representing a time, and set the value of the target field to a time value later than the creation time of the project object; the participant information field is used to represent information of participants who participate in the project object;
[0017] A change module, used for changing the value of the target field in the data table to the creation time when the project object ends;
[0018] The query module is used to query the data table according to the combined index and the query parameters included in the query request when a query request is obtained, and sort the queried data according to the value of the target field to obtain the query result.
[0019] The present application embodiment discloses an online course data query device, the device comprising:
[0020] a course creation module, for responding to a request to create an online course, constructing a data table including values of the student information field and the target field according to a combined index including a student information field and a target field representing a time, and setting the value of the target field to a time value later than the creation time of the online course; the student information field is used to represent information of students participating in the online course;
[0021] A value changing module, used for changing the value of the target field in the data table to the creation time when the online course ends;
[0022] The course query module is used to query the data table according to the combined index and the query parameters contained in the query request when a query request is obtained, and sort the queried data according to the value of the target field to obtain the query result.
[0023] An embodiment of the present application further discloses an electronic device, including: a processor; and a memory, on which executable code is stored. When the executable code is executed, the processor executes one or more methods described in the embodiments of the present application.
[0024] The embodiments of the present application also disclose one or more machine-readable media on which executable codes are stored. When the executable codes are executed, the processor executes one or more methods described in the embodiments of the present application.
[0025] Compared with the related art, the embodiments of the present application have the following advantages:
[0026] In the embodiment of the present application, when creating a project object, the value of the target field in the table is set to a time value later than the creation time, and when the project object ends, the value of the target field in the table is changed to the creation time. The purpose of this is to allow the ongoing project object to have a later time value than the ended project object on the timeline, thereby distinguishing between the two types of project objects in different states. When querying, the data obtained by the query is sorted according to the value of the target field, so that the project objects in the ongoing state and the project objects in the ended state are divided into two different categories for display, and the project objects are also sorted in the order of creation time. Therefore, the present application uses a target field to distinguish between project objects in multiple different states, and further realizes the sequential sorting of the creation time of the project objects, so that the query process can realize the query by using a smaller number of fields in the combined index on the basis of meeting the query requirements. The utilization efficiency of the combined index is higher, thereby improving the overall query efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a system architecture diagram of an embodiment of the present application;
[0028] Figure 2 This is a schematic diagram of a query scenario for online course data in an embodiment of the present application;
[0029] Figure 3 This is a schematic diagram of a data query scenario for a learning task in an embodiment of the present application;
[0030] Figure 4 This is a schematic diagram of a query scenario of online book data in an embodiment of the present application;
[0031] Figure 5 It is a flowchart of the steps of a data query method in an embodiment of the present application;
[0032] Figure 6 It is a flowchart of the specific steps of a data query method in an embodiment of the present application;
[0033] Figure 7 It is a timeline schematic diagram of an embodiment of the present application;
[0034] Figure 8 This is a flowchart of the steps of an online course data query method according to an embodiment of the present application;
[0035] Fig. 9 is a block diagram of a data query device according to an embodiment of the present application;
[0036] Fig.10 is a block diagram of an online course data query device according to an embodiment of the present application;
[0037] Fig.11It is a schematic diagram of the structure of a device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0039] In order to enable those skilled in the art to better understand the present application, the concepts involved in the present application are explained below:
[0040] Database: A collection of data that can be organized using a series of tables.
[0041] Data table: A grid virtual table that temporarily stores data, wherein a data column is a component of the data table and has a name and a specific data type (such as a value, date, etc.).
[0042] Project object: A service project that can be created, run continuously, and terminated. This service project can be participated in by members. For example, an online course in an online course application is a project object. After the online course is created, students can participate in the study. The process of online course teaching is the continuous operation process of the online course. After the teaching is completed, the online course can be terminated.
[0043] Participant information field: information representing the identity of members participating in the project object. For example, the participant information field may record the identity identifiers of each member participating in the project object.
[0044] Target field: is a field that represents the time. The target field is used to assign a time value later than the creation time when the project object is created, and change the value of the target field to the creation time when the project object ends, so as to distinguish between project objects in the ongoing state and project objects in the ended state. The purpose is to classify project objects in the ongoing state and project objects in the ended state into two different categories when querying, so as to avoid overlapping sorting of the two types of project objects and cause data confusion.
[0045] Composite index: An index composed of at least two fields. An index is a pointer to table data and is used to associate field values. An index can query a data table based on fields. By querying a table using a composite index, query efficiency can be improved while providing rich query granularity.
[0046] Query parameters: Parameters included in the query request that are used to define the query requirements. For example, query parameters can define the query object, query scope, and the sorting method of the data content of the query object.
[0047] Structured Query Language (SQL): A computer statement built on a database language with multiple functions such as data manipulation and data definition. Structured query statements can be generated for a database and used to query data in the database.
[0048] The data query method in the embodiment of the present application can be applied to different query scenarios, such as: the query scenario of online course data, the data query scenario of learning tasks, and the query scenario of online book data. Taking the query scenario of online course data as an example, the query requirements include: displaying a student's course list by paging according to uid, the ongoing courses are placed before the ended courses, and the course start time is sorted in descending order. The online course database of the learning application can construct a combined index containing student information fields and target fields representing the time, and in the process of constructing the online course data table, based on the fields contained in the combined index and the data related to the online course (such as the number of participating students, course status, creation time, teaching teacher, course subject, etc.), assign values to each field in the online course data table (including student information fields and target fields), so that the online course data table obtains data content. Specifically, when creating an online course, the embodiment of the present application can set the value of the target field in the table to a time value later than the creation time, and when the online course ends, change the value of the target field in the table to the creation time. The purpose of this is to make the ongoing online course have a later time value than the ended online course on the timeline, so as to achieve the two types of courses. courses; when querying, first obtain the data of each course participated by the student through the student information field in the combined index, and then sort the course data in descending order according to the target field, so that the online courses in progress and the online courses in the ended state are divided into two different categories, and the courses are sorted in descending order according to the creation time. Therefore, through a target field, on the basis of realizing the distinction between online courses in two different states, the descending sorting of the course creation time is further realized, so that the query process can meet the query requirements. The embodiment of the present application uses the target field in the combined index to sort the data when querying, which can not only realize enumeration classification for the query data, but also realize the sorting of the query data in the order of time, so that the combined index can realize the query requirements with a smaller number of fields, and the utilization efficiency of the combined index is higher, thereby improving the overall query efficiency.
[0049] Reference Figure 1, which shows a system architecture diagram of a data query method provided in an embodiment of the present application, including: user equipment, a server, and a database, wherein the server includes: a creation module, a change module, and a query module. The database can be a database of the server or a database independent of the server, which is not limited in the embodiment of the present application.
[0050] In an embodiment of the present application, the server can construct a combined index including a participant information field and a target field representing a moment, so as to realize table creation and query through the combined index. When a project object is created, the creation module of the server can respond to the request to create the project object, and according to the combined index, construct a data table in the database including the values of the participant information field and the values of the target field, and set the value of the target field to a moment value later than the creation moment of the project object. Specifically, during the table creation process, when the data content of the participant information is obtained, the creation module can first write the data content of the participant information into the value of the participant information field in the data table; after the values of the participant information fields are written, the moment value later than the creation moment of the project object is written into the value of the target field in the data table. During the entire process from the creation to the operation of the project object, the value of the target field remains unchanged.
[0051] Furthermore, when the project object is completed, the change module on the server side can change the value of the target field in the data table to the creation time. The creation module and the change module set and adjust the value of the target field in different situations, which can divide the project objects in progress and the project objects in the ended state into two different categories, thereby realizing the enumeration classification of project objects in different states.
[0052] Finally, when the server receives a query request sent by a user device, the query module of the server can query the data table in the database according to the combined index and the query parameters contained in the query request, and sort the queried data according to the value of the target field to obtain the query result. The query process is specifically based on the query object (target participant information) defined by the query parameters, the data sorting rules defined by the query parameters, and the fields of the combined index are constructed as a structured query statement (SQL statement). Then, by running the SQL statement, the query of the data table is automatically realized. The query results obtained include the data content associated with the query object (including the value of the field in the combined index), and because the project objects in different states in the data table are enumerated and classified through the value of the target field, when querying, the data content in the query result will also be sorted according to the value of the target field and the data sorting rules defined by the query parameters.
[0053] In the embodiments of the present application, examples of related technologies and examples of the solutions of the present application are provided below, so as to describe the entire data query solution in detail:
[0054] For the online course data query scenario of the learning application, the query requirements include: displaying the course list of the target student in pages according to the student information (uid), with the ongoing courses placed before the completed courses, and the courses sorted in descending order of start time.
[0055] In response to the above requirements, the data table constructed by the related technology may include three core fields: status indicates the course status, with a value of 1 indicating that it is in progress, and a value of 0 indicating that it has ended. start_time represents the start time of the course, and uid represents the student ID. When making a specific query, the related technology may construct a query statement based on a combined index including the above three fields arranged in order: idx (uid, status, start_time), such as constructing an SQL statement (it should be noted that the embodiment of the present application does not limit the specific form of the query statement):
[0056] select*from table where uid=#{uid};
[0057] order by status desc, start_time desc;
[0058] limit pageIndex, pageSize;
[0059] It should be noted that the embodiments of the present application do not limit the specific form of the query statement.
[0060] The first line of the SQL statement indicates: when querying, first query the matching data content in the data table according to the target student's uid: 001; the second line indicates: the matching data content for the target student's uid: 001 is first sorted in descending order according to the course status (the data content of status 1 is before the data content of status 0), and then sorted in descending order according to the course start time; the third line indicates: according to the set query range, select at least part of the data from the sorted results in the second line as the query result. An example of the query result is shown in Table 1 below:
[0061] uid Course Status Course start time Course Title …… 001 1 17:00 Language …… 001 1 16:00 math …… 001 0 10:00 English …… …… …… …… …… ……
[0062] Table 1
[0063] In the related art, the number of fields contained in the combined index is large, resulting in slow query efficiency. There is a status field of Boolean type (value 1 or 0) in the combined index. When querying, it is necessary to first sort the data content matched by the target student's uid in descending order according to the status, and then sort it in descending order according to the course start time. Two sortings are required to achieve: the ongoing courses are sorted before the completed courses. The query requirement of descending sorting of the course start time further reduces the query efficiency. In addition, the online courses in the data table will frequently change the course status. Each change requires the course status column in the data table to be re-sorted, which will cause the course start time column to be re-sorted accordingly, resulting in too much data operations and affecting database performance.
[0064] To solve the above problems, refer to Figure 2 , which shows a query scenario diagram of online course data provided by an embodiment of the present application, including: a user device, an online course server and an online course database. The data table of the online course database can add a column of target field order_value at the time of collection. The online course server can construct a combined index including uid and the target field order_value: idx(uid,order_value). When the online course is created, the online course server can construct a data table including the value of uid and the value of order_value in the database according to the combined index idx(uid,order_value). Furthermore, at the time when the online course ends, the online course server can change the value of the target field in the data table to the creation time of the online course. Finally, when the server obtains a query request sent by the user device, the online course server can construct a query statement based on the query parameters of the query request and the combined index idx(uid,order_value), such as constructing an SQL statement (it should be noted that the embodiment of the present application does not limit the specific form of the query statement):
[0065] select*from table where uid=#{uid:001};
[0066] order by order_value desc;
[0067] limit pageIndex,pageSize;
[0068] The first line of the SQL statement indicates: when querying, first query the matching data content in the data table according to the target student's uid: 001; the second line indicates: sort the matching data content for the target student's uid: 001 in descending order according to the value of the target field order_value; the third line indicates: according to the set query range, select at least part of the data from the sorted results in the second line as the query result. An example of the query result is shown in Table 2 below:
[0069] uid order_value Course start time Course Title Course Status …… 001 A timestamp representing a time later than 17:00 17:00 Language 1 …… 001 A timestamp representing a time later than 16:00 16:00 math 1 …… 001 A timestamp representing 10:00 10:00 English 0 …… …… …… …… …… …… ……
[0070] Table 2
[0071] For the above Table 2, after running the SQL statement, query data that meets the query requirements is obtained and sent to the user device to complete the query. Due to the changes in the value of the target field at the start and end of the online course, the ongoing online course has a later time value than the ended online course on the timeline, so that the query results can distinguish between the two course statuses. Therefore, the query results output can meet the query requirements of the ongoing courses being ranked before the ended courses, and the query requirements of sorting the courses in descending order of the start time are met.
[0072] It can be seen that compared with the related art, during the execution of the SQL statement, by sorting the value of order_value in descending order once, the query requirement that the online courses in progress are ranked before the online courses in the ended state is met, and the query requirement that the courses are sorted in descending order according to the creation time is met, thereby realizing the query process through a combined index containing fewer fields, thereby reducing the number of sorting times in the query process and improving the query efficiency. In addition, when the course status changes, it is only necessary to update the value of the target field order_value without adjusting the order of other fields, thereby reducing the number of data operations and improving database performance.
[0073] It should be noted that, based on the data query method provided in the embodiment of the present application, several other specific scenarios that can be implemented are as follows:
[0074] In another implementation, referring to Figure 3 , which shows a data query scenario diagram of a learning task provided by an embodiment of the present application. In this scenario, the learning application can publish learning tasks to improve students' learning efficiency. Tasks include home-school homework tasks, sports check-in tasks, home-school notification tasks, etc. The learning application has a workbench, and the workbench needs to display students' learning tasks in pages according to the following requirements: 1. Display by task type first, and the display order is to display home-school homework tasks first. 2. Tasks of the same task type are sorted in reverse order according to the deadline of the task, and the tasks that end first are placed in front of the tasks that end later.
[0075] The scenario includes: user device, learning task server and learning task database. The data table of the learning task database can add a column of target fields at the time of collection as a sorting dimension. The learning task server can construct a student identification field containing students participating in the learning task, and a combined index idx (user_id (student identification field), order_value (target field)) of the target field. When the learning task is created, the learning task server can construct a data table containing the values of the student identification field and the values of the target field in the database according to the combined index, and for sports check-in tasks and home-school notification tasks, the value of the corresponding target field is set to the deadline of the learning task, and for home-school homework tasks, the value of the corresponding target field is set to a time value later than the deadline (indicating that the home-school homework task is in a priority sorting queue). Finally, when the server obtains a query request sent by the user device, the learning task server can query the data table in the learning task database based on the query parameters and the combined index of the query request, sort the queried data according to the value of the target field, obtain the query results and send them to the user device to complete the query. Since the scheme sets the values of the target fields for different tasks, the query results can be distinguished for different tasks, so that the output query results meet the above query requirements.
[0076] In another implementation, referring to Figure 4 , which shows a schematic diagram of a query scenario for online book data provided by an embodiment of the present application. In this scenario, after obtaining the authorized book, the book application will produce a point-and-click book (add audio, video, annotations, interpretation, etc. to the book). After production, there will be a book shelving operation. After completion, users can read and purchase books. In some cases, books can also be removed from the shelves through a removal operation. The book application will provide the producer with a book list, and the books in the list need to be displayed in pages in a certain order: 1. Prioritize the display of books that have been on the shelves. 2. Among the books on the shelves, sort them in reverse order according to the last modification time. 3. Among the books removed from the shelves, sort them in reverse order according to the last modification time.
[0077] The scenario includes: user equipment, book server and book database. The data table of the book database can add a target field of the collection time as a sorting dimension. The book server can build a combined index idx (user_id (producer field), order_value (target field)) containing the producer identification field and the target field. The book server can build a data table containing the value of the producer field and the value of the target field in the database according to the combined index. When a book is created, the book is in the off-shelf state by default, and the value of the target field corresponding to the book is set to the modification time. After the book is produced and put on the shelf, the value of the target field corresponding to the book is set to a time value later than the modification time (indicating that the on-shelf book is in a priority sorting queue). When the book is subsequently taken off the shelf and modified, the value of the target field corresponding to the book is changed to the current modification time. Finally, when the server obtains a query request sent by the user device, the book server can query the data table in the book database based on the query parameters and the combined index of the query request, sort the queried data according to the value of the target field, obtain the query result and send it to the user device to complete the query. Since the scheme sets the value of the target field under different states of the book, the query result can distinguish the books under different states, so that the output query result meets the above query requirements.
[0078] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0079] Reference Figure 5 , which shows a step flow chart of a data query method provided by an embodiment of the present application, including:
[0080] Step 101, in response to a request to create a project object, construct a data table containing the values of the participant information field and the target field based on a combined index containing the participant information field and the target field representing the moment, and set the value of the target field to a time value that is later than the creation time of the project object.
[0081] The participant information field is used to represent the information of the participants who participate in the project object.
[0082] In the embodiment of the present application, a request to create a project object can be initiated by a management server that manages the project object. The purpose of creating a project object is to establish a data table related to the project object in the database, so as to provide users with the service of the project object through the data content in the data table. A project object is a service project that can be created, can run continuously, and can be terminated. The service project can be participated by members. For example, an online course in an online course application is a project object.
[0083] Furthermore, an index is a pointer to table data and is used to associate field values. A composite index is an index composed of at least two fields. By performing table lookup through a composite index, query efficiency can be improved while providing rich query granularity.
[0084] Specifically, the combined index may include a participant information field and a target field. The priority of the participant information field is greater than the priority of the target field, so that the combined index may be in the form of: idx(uid(participant information field), order_value(target field)). The participant information field may represent the identity information of the members participating in the project object, and the target field is a field representing a moment.
[0085] In an embodiment of the present application, the target field is used to assign a time value that is later than the creation time when the project object is created. The purpose is to place the project objects in the ongoing state in the priority sorting queue when the data content in the query results is subsequently sorted and displayed according to the value of the target field, thereby achieving the distinction between project objects in the ongoing state and project objects in the ended state.
[0086] Step 102, when the project object is ended, the value of the target field in the data table is changed to the creation time.
[0087] In an embodiment of the present application, when a project object ends, the value of the target field can be changed to the creation time. The purpose of this is to allow project objects in the ended state to be placed after project objects in the ongoing state when the data content in the query results is subsequently sorted and displayed according to the value of the target field, thereby achieving the distinction between different tasks in the query results, so that the output query results meet the above query requirements.
[0088] For example, if the project object is an online course in a learning application, and the creation time of the online course is 2008.10.10.14:20:30, then at the creation time of the online course, the value of the corresponding target field is set to a time value later than the creation time of the project object, such as a time value corresponding to 2058.10.10.14:20:30; when the online course is finished and at the end time, the value of the corresponding target field can be changed from the later time value corresponding to 2058.10.10.14:20:30 to the time value corresponding to the creation time of the online course 2008.10.10.14:20:30. In this way, when the data content in the query results is sorted and displayed according to the value of the target field, the online courses in the ended state are arranged after the online courses in the ongoing state, so that the query results can distinguish different tasks and meet the query requirements.
[0089] Step 103, when a query request is obtained, the data table is queried according to the combined index and the query parameters included in the query request, and the queried data is sorted according to the value of the target field to obtain a query result.
[0090] In an embodiment of the present application, when the server receives a query request sent by a user device, the server can query the data table in the database according to the combined index and the query parameters contained in the query request, and sort the queried data according to the value of the target field to obtain the query result. The query process is specifically based on the query object (target participant information) defined by the query parameters, the data sorting rules defined by the query parameters, and the fields of the combined index are constructed as SQL statements. Thereafter, by running the SQL statement, the query of the data table is automatically realized. The query results obtained include the data content associated with the query object (including the values of the fields in the combined index), and since the project objects in different states in the data table are enumerated and classified through the value of the target field, when querying, the data content in the query result will also be sorted according to the value of the target field and the data sorting rules defined by the query parameters.
[0091] To summarize, in the embodiment of the present application, when creating a project object, the value of the target field in the table is set to a time value later than the creation time, and when the project object ends, the value of the target field in the table is changed to the creation time. The purpose of this is to allow the ongoing project object to have a later time value than the ended project object on the timeline, thereby distinguishing between the two types of project objects in different states; when querying, by sorting the data obtained by the query according to the value of the target field, the project objects in the ongoing state and the project objects in the ended state are divided into two different categories for display, and the project objects are also sorted in the order of creation time. Therefore, the present application uses a target field to further realize the sequential sorting of the creation time of the project objects on the basis of realizing the distinction between project objects in multiple different states, so that the query process can realize the query by using a smaller number of fields in the combined index on the basis of meeting the query requirements, and the utilization efficiency of the combined index is higher, thereby improving the overall query efficiency.
[0092] Reference Figure 6 , which shows a specific step flow chart of a data query method provided by an embodiment of the present application, including:
[0093] Step 201, in response to a request to create a project object, when the data content of the participant information is obtained, the data content of the participant information is first written into the value of the participant information field in the data table.
[0094] The priority of the participant information field in the combined index is greater than the priority of the target field.
[0095] In an embodiment of the present application, for the combined index: idx(uid(participant information field), order_value(target field)), it can be defined that the priority of the participant information field uid is greater than the priority of the target field order_value. Specifically, in the combined index, the participant information field uid and the target field order_value are sorted in sequence from left to right.
[0096] Specifically, the above definition of field priority in the combined index aims to, in the process of establishing a data table, first write the data content of the participant information in the project object-related data into the value of the participant information field in the data table, so as to ensure that there is a data column in the data table for storing the participant information.
[0097] Step 202, after the value of the participant information field is written, a time value later than the creation time of the project object is written into the value of the target field in the data table.
[0098] In the embodiment of the present application, since the priority of the participant information field uid is defined to be greater than the priority of the target field order_value for the combined index: idx(uid(participant information field), order_value(target field)), after the value of the participant information field is written, the time value later than the creation time of the project object is written into the value of the target field in the data table, so that there is a data column in the data table for storing the value of the target field, and the data column storing the value of the target field is arranged after the data column storing the participant information in the data table. For example, referring to the form shown in the first and second columns in Table 2 above, the data column storing the value of the target field order_value is arranged after the data column storing the participant information uid in the data table.
[0099] Furthermore, the target field is assigned a time value that is later than the creation time when the project object is created. The purpose is to allow the project objects in the ongoing state to be placed in a priority sorting queue when the data content in the query results is subsequently sorted and displayed according to the value of the target field, thereby achieving the distinction between the project objects in the ongoing state and the project objects in the ended state.
[0100] Step 203, when the project object is ended, the value of the target field in the data table is changed to the creation time.
[0101] This step may be specifically referred to as the above step 102, which will not be described in detail here.
[0102] Optionally, in one implementation, step 203 may specifically include:
[0103] Sub-step 2031: Set the value of the target field to: the product of the creation time of the project object and the first coefficient.
[0104] Optionally, the first coefficient is any value between 5 and 1000. Preferably, the first coefficient is 1000. It should be noted that when the first coefficient is a value greater than 1, the purpose of setting the value of the target field to a time value later than the creation time of the project object can be achieved by setting the value of the target field to: the product of the creation time of the project object and the first coefficient. The range of the first coefficient: 5-1000 is a preferred empirical value. Selecting the value of the first coefficient within this range can make the distinction between project objects in progress and project objects in the ended state greater.
[0105] In the embodiment of the present application, the value of the target field may be in the form of a timestamp, which is used to represent a moment. The timestamp is specifically an integer that records the number of milliseconds. The timestamp of the current moment represents the number of milliseconds from 00:00:00 UTC on January 1, 1970 to the current moment, that is, the timestamp can reflect the current moment through milliseconds. For example, the time at 10:10:10 on October 22, 2008, may correspond to the timestamp: 1224641410000.
[0106] Specifically, in one implementation of an embodiment of the present application, when creating a project object, the value of the target field is set to a time value that is later than the creation time of the project object. The purpose is to place the project object in the ongoing state into a priority sorting queue when sorting according to the value of the target field during the query process, thereby distinguishing it from the project object in the ended state (the value of the target field of the project object in the ended state is the creation time). In order to achieve the above purpose, when creating a project object, the embodiment of the present application can set the value of the target field to: the product value of the creation time of the project object and the first coefficient, and the first coefficient can be any value from 5 to 1000. The value of the target field of the project object in the ongoing state is set to the product value of the creation time and the first coefficient. The project object in the ongoing state can be arranged on the timeline after the project object in the ended state, thereby distinguishing the two.
[0107] For example, refer to Figure 7 , which shows a timeline diagram. Assume that a project object 1 is created at the current time: 10:10:10 on May 25, 2008 (corresponding to the timestamp 1211681410). If the first coefficient is 10, the value of the target field of project object 1 can be 1211681410000×10=12116814100000, where 12116814100000 represents 20:05:41 on the 12th of the year 2353. For a completed project that is closer to the current time, The creation time of project object 2 represented by the value of the target field of project object 2 is 10:10:10 on April 25, 2008. The moment value represented by the value of the target field of project object 2 (the historical moment before the current moment) must be earlier than 05:41:40 on December 20, 2353, which is the future moment relative to the current moment. Therefore, by sorting according to the value of the target field, the project objects in the ongoing state must be arranged after the project objects in the completed state, meeting the query requirements.
[0108] Optionally, in one implementation, step 203 may specifically include:
[0109] Sub-step 2031: Set the value of the target field to the sum of the creation time of the project object and the second coefficient.
[0110] Optionally, the second coefficient is any value in the range of 7879680000-31536000000. It should be noted that when the second coefficient is a positive number, the value of the target field can be set to a time value later than the creation time of the project object by setting the value of the target field to the sum of the creation time of the project object and the second coefficient. The range of the second coefficient: 7879680000-31536000000 is a preferred empirical value. Selecting the value of the second coefficient in this range can make the distinction between the project objects in progress and the project objects in the ended state greater.
[0111] Specifically, in another implementation method of the embodiment of the present application, in order to achieve the purpose of distinguishing project objects in progress and project objects in ended status through the value of the target field, the embodiment of the present application can set the value of the target field to: the sum of the creation time of the project object and the second coefficient when creating the project object. The first coefficient can be any value between 7879680000-31536000000. The value of the target field of the project object in progress is set to the sum of the creation time and the second coefficient. The project object in progress can be arranged after the project object in ended status on the timeline, thereby achieving the distinction between the two.
[0112] Among them, 7879680000 and 31536000000 both represent milliseconds. The milliseconds 7879680000 correspond to 3 months, and the milliseconds 31536000000 correspond to 1 year. Assuming the second coefficient is 7879680000, it means that when creating a project object, the value of the target field is set to the corresponding time after the creation time 3 months later. For example, assuming that at the current time: a project object a is created at 10:10:10 on May 25, 2008, if the second coefficient is 7879680 000, the value of the target field of project object a can reflect the corresponding moment three months after the creation time. For a completed project object b that is closer to the current moment, the creation time of project object b represented by the value of the target field of project object b (the historical moment before the current moment) must be earlier than the corresponding moment three months after the creation time of project object a, which is the future moment relative to the current moment. Therefore, by sorting according to the value of the target field, the project objects in the ongoing state can be arranged after the project objects in the completed state, thus meeting the query requirements.
[0113] Step 204: construct a structured query statement according to the query parameter and the combined index; the structured query statement is used to query and obtain data, and sort the obtained data according to the value of the target field.
[0114] In the embodiment of the present application, the structured query statement (SQL) is a computer statement constructed based on a database language with multiple functions such as data manipulation and data definition. The structured query statement can be generated for the database and used to query data in the database. Specifically, the query process can be constructed as a structured query statement (SQL statement) based on the query object (target participant information) defined by the query parameters, the data sorting rules defined by the query parameters, and the fields of the combined index. After that, by running the SQL statement, the query of the data table is automatically realized, and the query results obtained include the data content associated with the query object (including the value of the field in the combined index), and the data content in the query result will also be sorted according to the value of the target field and the data sorting rules defined by the query parameters.
[0115] Optionally, step 204 may specifically include:
[0116] Sub-step 2041, obtaining query parameters contained in the query request, wherein the query parameters are used to define target participant information and a sorting rule for sorting the value of the target time in descending order; the priority of the participant information field in the combined index is greater than the priority of the target field.
[0117] Sub-step 2042: construct a structured query statement according to the query parameters and the combined index.
[0118] In an embodiment of the present application, for sub-steps 2041-2042, the query parameters may include target participant information and sorting rules, and the priority of the participant information field is greater than the priority of the target field, which means that the target participant information can first be used as the target query object, so that the specific query process queries the data content associated with the target participant, and then sorts the queried data content according to the sorting rules defined by the query parameters to obtain the query results.
[0119] Specifically, in this step, the query parameters and the combined index can construct a structured query statement. Assuming the combined index idx (uid, order_value), the target participant information in the query parameter is uid: 001, and the sorting rule in the query parameter is descending order desc, the constructed SQL statement (it should be noted that the embodiment of the present application does not limit the specific form of the query statement):
[0120] select*from table where uid=#{uid:001};
[0121] order by order_value desc;
[0122] The first line of the SQL statement means: when querying, first query the matching data content in the data table according to the target student's uid: 001; the second line means: the matching data content for the target student's uid: 001 is sorted in descending order according to the value of the target field order_value.
[0123] Step 205: In response to executing the structured query statement, obtain the query result.
[0124] In an embodiment of the present application, since the structured query statement is an operation for querying data in a database based on a combined index and query parameter definition, by running the structured query statement, the data content of the field associated with the target participant information in the query parameters and belonging to the combined index can be queried from the data table, and the data content can be sorted according to the value of the target field and the sorting rules defined by the query parameters to obtain the query results.
[0125] Optionally, step 205 may specifically include:
[0126] Sub-step 2051: In response to the execution of the structured query statement, the data content of the target participant information in the data table is obtained.
[0127] Sub-step 2052: sort the data content of the target participant information in descending order according to the value at the target time to obtain the query result.
[0128] In an embodiment of the present application, for sub-steps 2051-2052, when the structured query statement is executed, the data content of the target participant information in the data table can be first obtained, and then the data content of the target participant information is sorted in descending order according to the value of the target time to obtain the query result. By sorting the value of the target field in the combined index, on the basis of realizing the distinction between project objects in two different states (in progress and ended), the sequential sorting of the creation time of the project objects is further realized, so that the query process can realize the query by using a smaller number of fields in the combined index on the basis of meeting the query requirements, and the utilization efficiency of the combined index is high, thereby improving the overall query efficiency.
[0129] For example, in the online course data query scenario, when an online course is constructed, the online course will have students participating in the class. The student's student ID is the participant information of the online course project object. A student may participate in multiple online courses at the same time. When the course schedule is issued for the student, the student ID of the student can be used as the target participant information, and the relevant data content of each online course in which the student participates can be queried from the data table. Then, the relevant data content of each online course in which the student participates can be sorted in descending order according to the value of the target field. Since the target field value is sorted in descending order, the online courses in progress can be put into the priority sorting queue, thereby distinguishing them from the online courses in the ended state. Therefore, the query process not only meets the requirements of the ongoing courses being sorted before the ended courses, but also meets the requirements of sorting in descending order according to the start time of the course.
[0130] Optionally, the query strategy also includes a query range, and sub-step 2052 can be specifically implemented by sorting the data content of the target participant information in descending order according to the value at the target time, and then extracting the query result from the descending sorted result according to the query range.
[0131] In an embodiment of the present application, based on actual needs, the query strategy may also include a query range, which defines which part of the data is taken from the query results and ultimately fed back to the user device. Since the data content queried from the data table can exist in the form of data pages, when performing paging queries, the query range may specifically define the page index (pageIndex, defining the number of pages) and the page size (pageSize, defining how much data is in a page). After sorting the data content of the target participant information in descending order according to the value at the target time, the query results that are ultimately fed back to the user device can be extracted from the descending sorted results based on the definition of the number of pages and page size of the query range.
[0132] To summarize, in the embodiment of the present application, when creating a project object, the value of the target field in the table is set to a time value later than the creation time, and when the project object ends, the value of the target field in the table is changed to the creation time. The purpose of this is to allow the ongoing project object to have a later time value than the ended project object on the timeline, thereby distinguishing between the two types of project objects in different states; when querying, by sorting the data obtained by the query according to the value of the target field, the project objects in the ongoing state and the project objects in the ended state are divided into two different categories for display, and the project objects are also sorted in the order of creation time. Therefore, the present application uses a target field to further realize the sequential sorting of the creation time of the project objects on the basis of realizing the distinction between project objects in multiple different states, so that the query process can realize the query by using a smaller number of fields in the combined index on the basis of meeting the query requirements, and the utilization efficiency of the combined index is higher, thereby improving the overall query efficiency.
[0133] Reference Figure 8 , which shows a flowchart of the steps of an online course data query method provided by an embodiment of the present application, including:
[0134] Step 301, in response to a request to create an online course, construct a data table containing values of the student information field and the target field based on a combined index containing a student information field and a target field representing a moment, and set the value of the target field to a time value that is later than the creation time of the online course.
[0135] The student information field is used to represent the information of students participating in the online course.
[0136] Step 302: When the online course ends, the value of the target field in the data table is changed to the creation time.
[0137] Step 303: when a query request is obtained, the data table is queried according to the combined index and the query parameters included in the query request, and the queried data is sorted according to the value of the target field to obtain a query result.
[0138] Specifically, the relevant description of steps 301-303 can refer to the above Figure 2 The contents of the embodiments are not described in detail here.
[0139] In summary, in the embodiment of the present application, when creating an online course, the value of the target field in the table can be set to a time value later than the creation time, and when the online course ends, the value of the target field in the table can be changed to the creation time. The purpose of this is to make the ongoing online course have a later time value than the ended online course on the timeline, so as to distinguish between the two types of courses; when querying, first obtain the data of each course participated in by the student through the student information field in the combined index, and then sort the course data in descending order according to the target field, so that the online courses in progress and the online courses in the ended state are divided into two different categories, and the courses are sorted in descending order according to the creation time, so that through a target field, on the basis of distinguishing the online courses in two different states, the descending sorting of the course creation time is further realized, so that the query process can meet the query requirements. The embodiment of the present application sorts the data during the query through the target field in the combined index, which can not only realize the enumeration classification for the query data, but also realize the sorting of the query data in the order of time, so that the combined index can realize the query requirements with a smaller number of fields, and the utilization efficiency of the combined index is high, thereby improving the overall query efficiency.
[0140] Reference Fig. 9 , which shows a block diagram of a data query device provided by an embodiment of the present application, including:
[0141] A construction module 401 is used to respond to a request to create a project object, construct a data table including values of the participant information field and the target field according to a combined index including a participant information field and a target field representing a time, and set the value of the target field to a time value later than the creation time of the project object; the participant information field is used to represent information of participants who participate in the project object;
[0142] A change module 402, configured to change the value of the target field in the data table to the creation time when the project object is ended;
[0143] The query module 403 is used to query the data table according to the combined index and the query parameters included in the query request when a query request is obtained, and sort the queried data according to the value of the target field to obtain a query result.
[0144] Optionally, the construction module 401 includes:
[0145] The first adjustment submodule is used to set the value of the target field to: the product value of the creation time of the project object and the first coefficient.
[0146] Optionally, the first coefficient is any value between 5 and 1000.
[0147] Optionally, the construction module 401 includes:
[0148] The second adjustment submodule is used to set the value of the target field to: the sum of the creation time of the project object and the second coefficient.
[0149] Optionally, the second coefficient is any value between 7879680000 and 31536000000.
[0150] Optionally, the query module 403 includes:
[0151] A construction submodule, used to construct a structured query statement according to the query parameter and the combined index; the structured query statement is used to query and obtain data, and sort the obtained data according to the value of the target field;
[0152] The execution submodule is used to obtain the query result in response to the execution of the structured query statement.
[0153] Optionally, the construction submodule includes:
[0154] an acquisition unit, configured to acquire query parameters included in the query request, wherein the query parameters are used to define target participant information and a sorting rule for sorting the values at the target time in descending order; the priority of the participant information field in the combined index is greater than the priority of the target field;
[0155] The acquisition unit is used to construct a structured query statement according to the query parameter and the combined index.
[0156] Optionally, the execution submodule includes:
[0157] A response unit, configured to obtain data content of target participant information in the data table in response to the execution of the structured query statement;
[0158] The sorting unit is used to sort the data content of the target participant information in descending order according to the value at the target time to obtain the query result.
[0159] Optionally, the query strategy further includes a query range, and the sorting unit includes:
[0160] The sorting subunit is used to extract the query result from the descending sorted results according to the query range after sorting the data content of the target participant information in descending order according to the value of the target time.
[0161] Optionally, the priority of the participant information field in the combined index is greater than the priority of the target field; the construction module 401 includes:
[0162] A first writing submodule is used for responding to a request to create a project object, and when obtaining the data content of the participant information, first writing the data content of the participant information into the value of the participant information field in the data table;
[0163] The second writing submodule is used to write a time value later than the creation time of the project object into the value of the target field in the data table after the value of the participant information field is written.
[0164] To summarize, in an embodiment of the present application, when creating a project object, the value of the target field in the table can be set to a time value later than the creation time, and when the project object ends, the value of the target field in the table can be changed to the creation time. The purpose of this is to allow the ongoing project object to have a later time value than the ended project object on the timeline, thereby distinguishing between two types of project objects in different states. When querying, the data obtained by the query is sorted according to the value of the target field, so that the project objects in the ongoing state and the project objects in the ended state are divided into two different categories for display, and the project objects are also sorted in the order of creation time. Therefore, the present application uses a target field to further realize the sequential sorting of the creation time of the project objects on the basis of realizing the distinction between project objects in multiple different states, so that the query process can realize the query by using a smaller number of fields in the combined index on the basis of meeting the query requirements. The utilization efficiency of the combined index is high, thereby improving the overall query efficiency.
[0165] Reference Fig.10 , which shows a block diagram of an online course data query device provided by an embodiment of the present application, including:
[0166] The course creation module 501 is used to respond to a request to create an online course, construct a data table including values of the student information field and the target field according to a combined index including a student information field and a target field representing a time, and set the value of the target field to a time value later than the creation time of the online course; the student information field is used to represent information of students participating in the online course;
[0167] A value changing module 502, configured to change the value of the target field in the data table to the creation time when the online course ends;
[0168] The course query module 503 is used to query the data table according to the combined index and the query parameters included in the query request when a query request is obtained, and sort the queried data according to the value of the target field to obtain the query result.
[0169] In summary, in the embodiment of the present application, when creating an online course, the value of the target field in the table can be set to a time value later than the creation time, and when the online course ends, the value of the target field in the table can be changed to the creation time. The purpose of this is to make the ongoing online course have a later time value than the ended online course on the timeline, so as to distinguish between the two types of courses; when querying, first obtain the data of each course participated in by the student through the student information field in the combined index, and then sort the course data in descending order according to the target field, so that the online courses in progress and the online courses in the ended state are divided into two different categories, and the courses are sorted in descending order according to the creation time, so that through a target field, on the basis of distinguishing the online courses in two different states, the descending sorting of the course creation time is further realized, so that the query process can meet the query requirements. The embodiment of the present application sorts the data during the query through the target field in the combined index, which can not only realize the enumeration classification for the query data, but also realize the sorting of the query data in the order of time, so that the combined index can realize the query requirements with a smaller number of fields, and the utilization efficiency of the combined index is high, thereby improving the overall query efficiency.
[0170] The embodiment of the present application also provides a non-volatile readable storage medium, which stores one or more modules (programs). When the one or more modules are applied to a device, the device can execute instructions (instructions) of each method step in the embodiment of the present application.
[0171] The present application embodiment provides one or more machine-readable media on which instructions are stored, and when executed by one or more processors, an electronic device executes one or more of the methods described in the above embodiments. In the present application embodiment, the electronic device includes various types of devices such as terminal devices and server terminals (clusters).
[0172] The embodiments of the present disclosure may be implemented as a device that uses any appropriate hardware, firmware, software, or any combination thereof to perform desired configurations, and the device may include electronic devices such as terminal devices and server (cluster). Fig.11 An exemplary device 1000 that can be used to implement various embodiments described in the embodiments of the present application is schematically shown.
[0173] For one embodiment, Fig.11An exemplary apparatus 1000 is shown having one or more processors 1002, a control module (chip set) 1004 coupled to at least one of the processor(s) 1002, a memory 1006 coupled to the control module 1004, a non-volatile memory (NVM) / storage device 1008 coupled to the control module 1004, one or more input / output devices 1010 coupled to the control module 1004, and a network interface 1012 coupled to the control module 1004.
[0174] The processor 1002 may include one or more single-core or multi-core processors, and the processor 1002 may include any combination of general-purpose processors or special-purpose processors (such as graphics processors, application processors, baseband processors, etc.). In some embodiments, the device 1000 can be used as a terminal device, a server (cluster), and other devices described in the embodiments of the present application.
[0175] In some embodiments, the apparatus 1000 may include one or more computer-readable media (e.g., memory 1006 or NVM / storage device 1008) having instructions 1014 and one or more processors 1002 combined with the one or more computer-readable media and configured to execute the instructions 1014 to implement a module to perform the actions described in the present disclosure.
[0176] For one embodiment, the control module 1004 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 1002 and / or any suitable device or component in communication with the control module 1004 .
[0177] The control module 1004 may include a memory controller module to provide an interface to the memory 1006. The memory controller module may be a hardware module, a software module, and / or a firmware module.
[0178] The memory 1006 may be used, for example, to load and store data and / or instructions 1014 for the device 1000. For one embodiment, the memory 1006 may include any suitable volatile memory, such as a suitable DRAM. In some embodiments, the memory 1006 may include double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).
[0179] For one embodiment, control module 1004 may include one or more input / output controllers to provide an interface to NVM / storage device 1008 and input / output device(s) 1010 .
[0180] For example, NVM / storage 1008 may be used to store data and / or instructions 1014. NVM / storage 1008 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives (HDDs), one or more compact disk (CD) drives, and / or one or more digital versatile disk (DVD) drives).
[0181] NVM / storage device 1008 may include storage resources that are physically part of the device on which apparatus 1000 is installed, or it may be accessible to the device without being part of the device. For example, NVM / storage device 1008 may be accessed via input / output device(s) 1010 over a network.
[0182] (One or more) input / output devices 1010 may provide an interface for the apparatus 1000 to communicate with any other appropriate device, and the input / output device 1010 may include a communication component, an audio component, a sensor component, etc. The network interface 1012 may provide an interface for the apparatus 1000 to communicate through one or more networks, and the apparatus 1000 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols, for example, accessing a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, etc., or a combination thereof for wireless communication.
[0183] For one embodiment, at least one of the processor(s) 1002 may be packaged together with the logic of one or more controllers (e.g., a memory controller module) of the control module 1004. For one embodiment, at least one of the processor(s) 1002 may be packaged together with the logic of one or more controllers of the control module 1004 to form a system-in-package (SIP). For one embodiment, at least one of the processor(s) 1002 may be integrated on the same die with the logic of one or more controllers of the control module 1004. For one embodiment, at least one of the processor(s) 1002 may be integrated on the same die with the logic of one or more controllers of the control module 1004 to form a system-on-chip (SoC).
[0184] In various embodiments, the device 1000 may be, but is not limited to, a terminal device such as a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). In various embodiments, the device 1000 may have more or fewer components and / or different architectures. For example, in some embodiments, the device 1000 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an application-specific integrated circuit (ASIC), and a speaker.
[0185] Among them, the main control chip can be used as a processor or control module in the detection device, sensor data, location information, etc. are stored in a memory or NVM / storage device, the sensor group can be used as an input / output device, and the communication interface may include a network interface.
[0186] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0187] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0188] The present application embodiment is described with reference to the flowchart and / or block diagram of the method, terminal device (system) and computer program product according to the embodiment of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, and the combination of the process and / or box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device produce a device for implementing the function specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.
[0189] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0190] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0191] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0192] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0193] The data query method and device, electronic device, and machine-readable medium provided by the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. Under the same circumstances, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data query method, characterized in that: include: In response to a request to create a project object, a data table including values of the participant information field and the target field is constructed according to a combined index including a participant information field and a target field representing a time, and the value of the target field is set to a time value later than the creation time of the project object; the participant information field is used to represent information of participants who participate in the project object; When the project object is ended, the value of the target field in the data table is changed to the creation time; When a query request is obtained, the data table is queried according to the combined index and the query parameters included in the query request, and the queried data is sorted according to the value of the target field to obtain a query result.
2. The method according to claim 1, characterized in that The step of setting the value of the target field to a time value later than the creation time of the project object comprises: The value of the target field is set to: the product value of the creation time of the project object and the first coefficient.
3. The method according to claim 1, characterized in that The step of setting the value of the target field to a time value later than the creation time of the project object comprises: The value of the target field is set to: the sum of the creation time of the project object and the second coefficient.
4. The method according to claim 1, characterized in that: When a query request is obtained, querying the data table according to the combined index and the query parameters included in the query request, and sorting the queried data according to the value of the target field to obtain the query result includes: A structured query statement is constructed according to the query parameter and the combined index; the structured query statement is used to query and obtain data, and the obtained data is sorted according to the value of the target field; In response to executing the structured query statement, the query result is obtained.
5. The method according to claim 4, characterized in that The constructing a structured query statement according to the query parameter and the combined index includes: Obtaining query parameters included in the query request, wherein the query parameters are used to define target participant information and a sorting rule for sorting the values at the target time in descending order; the priority of the participant information field in the combined index is greater than the priority of the target field; A structured query statement is constructed according to the query parameter and the combined index.
6. The method according to claim 5, characterized in that The obtaining the query result in response to the execution of the structured query statement includes: In response to the execution of the structured query statement, obtaining data content of the target participant information in the data table; The data content of the target participant information is sorted in descending order according to the value at the target time to obtain the query result.
7. The method according to claim 6, characterized in that The query strategy also includes a query scope, and the data content of the target participant information is sorted in descending order according to the value at the target time to obtain the query result, including: After sorting the data content of the target participant information in descending order according to the value of the target time, the query result is extracted from the results of the descending order according to the query range.
8. The method according to claim 1, characterized in that The priority of the participant information field in the combined index is greater than the priority of the target field; in response to the request to create a project object, a data table containing the values of the participant information field and the target field is constructed according to the combined index containing the participant information field and the target field representing the moment, including: In response to a request to create a project object, when the data content of the participant information is obtained, the data content of the participant information is first written into the value of the participant information field in the data table; After the value of the participant information field is written, a time value later than the creation time of the project object is written into the value of the target field in the data table.
9. A method for querying online course data, characterized in that: include: In response to a request to create an online course, a data table including values of the student information field and the target field is constructed according to a combined index including the student information field and the target field representing a time, and the value of the target field is set to a time value later than the creation time of the online course; The student information field is used to represent the information of students participating in the online course; When the online course ends, the value of the target field in the data table is changed to the creation time; When a query request is obtained, the data table is queried according to the combined index and the query parameters included in the query request, and the queried data is sorted according to the value of the target field to obtain a query result.
10. A data query device, characterized in that: include: A construction module, configured to, in response to a request to create a project object, construct a data table including values of the participant information field and the target field according to a combined index including a participant information field and a target field representing a time, and set the value of the target field to a time value later than the creation time of the project object; the participant information field is used to represent information of participants who participate in the project object; A change module, used for changing the value of the target field in the data table to the creation time when the project object ends; The query module is used to query the data table according to the combined index and the query parameters included in the query request when a query request is obtained, and sort the queried data according to the value of the target field to obtain the query result.
11. An electronic device, characterized in that: include: processor; and A memory having executable codes stored thereon, which, when the executable codes are executed, enable the processor to perform the method according to any one of claims 1 to 9.
12. One or more machine-readable media having executable codes stored thereon, which, when executed, cause a processor to perform the method according to any one of claims 1 to 9.