Table merging method, apparatus, device, and medium

By merging tables with relationships in the database management system, join queries were implemented, improving query and processing efficiency and flexibility, and solving the problem of the lack of join query functionality in the database management system.

CN117933205BActive Publication Date: 2026-07-31SOUNDAI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SOUNDAI TECH CO LTD
Filing Date
2024-01-25
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Database management systems like MongoDB lack join functionality, making querying and processing difficult when multiple tables need to be joined.

Method used

This paper provides a table merging method that merges two tables into one table by identifying the fields in the two tables that have a relationship, thereby enabling table join queries.

Benefits of technology

It improves the efficiency and flexibility of table querying and processing, and solves the problem of the lack of table join query function in the database management system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117933205B_ABST
    Figure CN117933205B_ABST
Patent Text Reader

Abstract

This application provides a table merging method, apparatus, device, and medium, belonging to the field of computer technology. The method includes: obtaining a first table and a second table; determining, based on the first and second tables, a first field name and a second field name with a correlation relationship, wherein the first field name is a field name in the first table, the second field name is a field name in the second table, and the first field value corresponding to the first field name corresponds one-to-one with the second field value corresponding to the second field name; merging the first and second tables based on the correspondence between the first and second field values, the correspondence between the first field value and the field values ​​corresponding to other field names in the first table, and the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, to obtain a third table. This solution improves the efficiency and flexibility of table querying and processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device and medium for merging tables. Background Technology

[0002] Database management systems are very powerful computer tools that can be used to manage large amounts of data. They can be used in both enterprise systems and applications, and have become one of the most important tools in the field of computer technology.

[0003] However, some database management systems, such as MongoDB (a database based on distributed file storage), lack the ability to perform join queries when processing data, which makes querying and processing difficult when multiple tables need to be joined. Summary of the Invention

[0004] This application provides a table merging method, apparatus, device, and medium, which improves the efficiency and flexibility of table querying and processing. The technical solution is as follows:

[0005] On the one hand, a table merging method is provided, the method comprising:

[0006] Obtain a first table and a second table. Each table includes at least one field name and at least one piece of data. Each piece of data includes a field value corresponding to the at least one field name. The field values ​​corresponding to different field names in the same piece of data correspond one-to-one.

[0007] Based on the first table and the second table, determine the first field name and the second field name that have an association relationship. The first field name is the field name in the first table, and the second field name is the field name in the second table. The first field value corresponding to the first field name and the second field value corresponding to the second field name are in one-to-one correspondence.

[0008] Based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field values ​​corresponding to other field names in the first table, and the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, the first table and the second table are merged to obtain the third table.

[0009] On the other hand, a table merging apparatus is provided, the apparatus comprising:

[0010] The acquisition module is used to acquire a first table and a second table. The table includes at least one field name and at least one piece of data. Each piece of data includes the field value corresponding to the at least one field name. The field values ​​corresponding to different field names in the same piece of data correspond one-to-one.

[0011] The determination module is used to determine, based on the first table and the second table, a first field name and a second field name that have an association relationship, wherein the first field name is a field name in the first table, the second field name is a field name in the second table, and the first field value corresponding to the first field name and the second field value corresponding to the second field name correspond one-to-one.

[0012] The merging module is used to merge the first table and the second table to obtain a third table based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field value corresponding to other field names in the first table, and the correspondence between the second field value and the field value corresponding to other field names in the second table.

[0013] In one possible implementation, the determining module is configured to display a merge setting interface for the first table and the second table, the merge setting interface including at least one field name in the first table and at least one field name in the second table; in response to an association operation on any field name in the first table and any field name in the second table, the selected field name is determined as the first field name and the second field name that have an association relationship between the first table and the second table.

[0014] In one possible implementation, the determining module is further configured to display a correspondence acquisition option in the merge settings interface, the correspondence acquisition option being used to acquire the correspondence between the field values ​​corresponding to two field names that have an association relationship; and based on the correspondence acquisition option, to acquire the correspondence between the first field value and the second field value.

[0015] In one possible implementation, the determining module is used to determine the field names in the first table and the second table that have the same field names and whose corresponding field values ​​are unique identifiers as the first field name and the second field name that have an association relationship.

[0016] In one possible implementation, the merging module is configured to display a merging settings interface for the first table and the second table, the merging settings interface including at least one field name in the first table and at least one field name in the second table; in response to a selection operation of at least one field name in the first table and at least one field name in the second table, based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field value corresponding to other field names in the first table, and the correspondence between the second field value and the field value corresponding to other field names in the second table, the selected field name and the field value corresponding to the selected field name in the first table are merged with the selected field name and the field value corresponding to the selected field name in the second table to obtain a third table.

[0017] In one possible implementation, the merging module is configured to, in response to a setting operation that sets the first table as the main table, determine the order of at least one field name in the first table and at least one field name in the second table in the merged table; and, based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field value corresponding to other field names in the first table, the correspondence between the second field value and the field value corresponding to other field names in the second table, and the order of at least one field name in the first table and at least one field name in the second table in the merged table, merge the first table and the second table to obtain a third table.

[0018] In one possible implementation, the merging module is configured to: add at least one field name from the first table and at least one field name from the second table to the third table based on the order of at least one field name from the first table and at least one field name from the second table in the merged table; add field values ​​from the first table to the third table based on the correspondence between the first field value and the field values ​​corresponding to other field names in the first table, such that the third table includes at least one piece of data; for any piece of data in the third table, based on the correspondence between the first field value and the second field value and the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, find target data corresponding to the data in the second table, add the target data at the position corresponding to the data in the third table, and mark the target data in the second table; after adding target data based on each piece of data in the third table, if there is unmarked data in the second table, add the unmarked data at the position corresponding to at least one field name in the second table in the third table.

[0019] In one possible implementation, the determining module is further configured to determine a third field name and a fourth field name that have an association relationship based on the third table and the fourth table, wherein the third field name is a field name in the third table, the fourth field name is a field name in the fourth table, and the third field value corresponding to the third field name corresponds one-to-one with the fourth field value corresponding to the fourth field name.

[0020] The merging module is further configured to merge the third table and the fourth table based on the correspondence between the third field value and the fourth field value, the correspondence between the third field value and the field values ​​corresponding to other field names in the third table, and the correspondence between the fourth field value and the field values ​​corresponding to other field names in the fourth table, to obtain a fifth table.

[0021] In one possible implementation, the acquisition module is used to export the first table and the second table from the database management system.

[0022] On the other hand, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one piece of program code, the at least one piece of program code being loaded and executed by the processor to implement the table merging method as described in any of the above implementations.

[0023] On the other hand, a computer-readable storage medium is provided that stores at least one piece of program code, which is loaded and executed by a processor to implement the table merging method as described in any of the above implementations.

[0024] On the other hand, a computer program product is provided, the computer program product comprising at least one piece of program code, the at least one piece of program code being loaded and executed by a processor to implement the table merging method as described in any of the above implementations.

[0025] The beneficial effects of the technical solutions provided in this application include at least the following:

[0026] This application provides a table merging method that can merge two tables into one based on two related field names. This method can be used when the database management system lacks the function of table join query, so that the tables that need to be joined can be merged and queries can be performed in the merged table. This solves the problem caused by the lack of table join query function in the database management system, improves the efficiency of table query and processing, and also improves the flexibility of table query and processing. Attached Figure Description

[0027] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0028] Figure 1 This is a schematic diagram of an implementation environment provided in an embodiment of this application;

[0029] Figure 2 This is a flowchart of a table merging method provided in an embodiment of this application;

[0030] Figure 3 This is a flowchart of a table merging method provided in an embodiment of this application;

[0031] Figure 4 This is a schematic diagram of the structure of a table merging device provided in an embodiment of this application;

[0032] Figure 5 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application;

[0033] Figure 6 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation

[0034] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0035] The terms "first," "second," "third," and "fourth," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0036] It should be noted that all information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this application have been authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the forms involved in this application were obtained with full authorization.

[0037] The table merging method provided in this application is executed by a computer device. In some embodiments, the computer device may be a terminal, such as a computer, mobile phone, tablet computer, or other terminal. This application does not limit the type of terminal. In other embodiments, the computer device may be a server. The server may be a single server, a server cluster consisting of several servers, or a cloud computing service center. Of course, the server may also include other functional servers to provide more comprehensive and diversified services. In other embodiments, the computer device includes electronic devices and servers. It should be noted that this application is merely an illustrative description of the executing entity of the table merging method and does not limit the executing entity.

[0038] Figure 1 This is a schematic diagram of an implementation environment provided in an embodiment of this application, such as... Figure 1 As shown, the implementation environment includes a terminal 101 and a server 102, which are connected via a wired or wireless network.

[0039] In some embodiments, server 102 is equipped with a database management system, and terminal 101 obtains multiple tables from the database management system in server 102 and merges the multiple tables into one table.

[0040] In some embodiments, a target application provided by server 102 is installed on terminal 101, enabling terminal 101 to perform functions such as data transmission and message interaction. Optionally, the target application is a target application in the operating system of terminal 101, or a target application provided by a third party. For example, the target application is a data management application with functions such as data query and data processing. Of course, the target application may also have other functions, such as review functions, shopping functions, navigation functions, and game functions.

[0041] Optionally, terminal 101 can be a computer, mobile phone, tablet computer, or other terminal. Optionally, server 102 can be a backend server for the target application or a cloud server that provides cloud computing and cloud storage services.

[0042] It should be noted that the above process can be executed by terminal 101 and server 102 in cooperation, and there is no limitation on which specific steps terminal 101 and server 102 execute.

[0043] It should be noted that some database management systems, such as MongoDB, lack the functionality for join queries when processing data. In this embodiment, when the database management system lacks join functionality, the tables requiring join queries can be exported from the database management system and then... Figure 2 or Figure 3 The method shown merges the tables that need to be joined, and then performs the query in the merged table to solve the problem caused by the lack of join query function in the database management system.

[0044] Figure 2 This is a flowchart illustrating a table merging method provided in an embodiment of this application. This embodiment uses a computer device as an example for illustrative purposes. See also... Figure 2 The method includes:

[0045] 201. The computer device obtains a first table and a second table. The table includes at least one field name and at least one piece of data. Each piece of data includes the field value corresponding to the at least one field name. The field values ​​corresponding to different field names in the same piece of data correspond one-to-one.

[0046] In this embodiment, the first table and the second table are tables that need to be joined for lookup. In some embodiments, the first table and the second table are Excel spreadsheets. Of course, the first table and the second table can also be other types of tables. This embodiment does not limit the types of the first table and the second table.

[0047] In a table, a field name is a name used to identify and distinguish the data in each cell. In a table, a field name is usually a column name or a row name, and a field value is the cell data corresponding to the field name. One field name can correspond to multiple field values.

[0048] Table 1

[0049] Student ID Name age address Class number S1 Xiao Zhang 15 Community A C1 S2 Xiao Li 16 Community B C1

[0050] Taking Table 1 above as an example, "Student ID", "Name", "Age", "Address", and "Class Number" are the field names; "S1" and "S2" are the field values ​​corresponding to the field name "Student ID"; "Xiao Zhang" and "Xiao Li" are the field values ​​corresponding to the field name "Name", and so on. Table 1 contains two data entries: "S1; Xiao Zhang; 15; A Community; C1" is one data entry, and "S2; Xiao Li; 16; B Community; C1" is another data entry.

[0051] 202. The computer device determines a first field name and a second field name that are related based on the first table and the second table. The first field name is the field name in the first table, and the second field name is the field name in the second table. The first field value corresponding to the first field name and the second field value corresponding to the second field name are in one-to-one correspondence.

[0052] Since the first table and the second table are tables that require join queries, they include first field names and second field names that are related. In this embodiment, the relatedness between the first field name and the second field name means that the first field value corresponding to the first field name corresponds one-to-one with the second field value corresponding to the second field name. In other words, a computer device can find a unique second field value in the second table based on any first field value, or a computer device can find a unique first field value in the first table based on any second field value.

[0053] 203. Based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field values ​​corresponding to other field names in the first table, and the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, the computer device merges the first table and the second table to obtain the third table.

[0054] After merging the first and second tables, a third table is obtained. Data queries can be performed in the third table to achieve the effect of table join queries.

[0055] This application provides a table merging method that can merge two tables into one based on two related field names. This method can be used when the database management system lacks the function of table join query, so that the tables that need to be joined can be merged and queries can be performed in the merged table. This solves the problem caused by the lack of table join query function in the database management system, improves the efficiency of table query and processing, and also improves the flexibility of table query and processing.

[0056] In one possible implementation, based on the first table and the second table, the first field name and the second field name with a relationship are determined, including:

[0057] Displays the merge settings interface for the first table and the second table. The merge settings interface includes at least one field name from the first table and at least one field name from the second table.

[0058] In response to an association operation on any field name in the first table and any field name in the second table, the selected field name is determined as the first field name and the second field name that have an association relationship between the first table and the second table.

[0059] In one possible implementation, after determining the selected field name as the first and second field names that have a relationship with each other in the first and second tables, in response to an association operation on any field name in the first table and any field name in the second table, the method further includes:

[0060] The Merge Settings interface displays the Correspondence Acquisition option, which is used to retrieve the correspondence between the field values ​​corresponding to two related field names.

[0061] Based on the correspondence, retrieve the options and obtain the correspondence between the values ​​of the first field and the second field.

[0062] In one possible implementation, based on the first table and the second table, the first field name and the second field name with a relationship are determined, including:

[0063] The field names in the first and second tables that have the same field name and whose corresponding field value is a unique identifier are identified as the first and second field names that have a relationship.

[0064] In one possible implementation, based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field values ​​corresponding to other field names in the first table, and the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, the first table and the second table are merged to obtain a third table, including:

[0065] Displays the merge settings interface for the first table and the second table. The merge settings interface includes at least one field name from the first table and at least one field name from the second table.

[0066] In response to the selection operation of at least one field name in the first table and at least one field name in the second table, based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field value corresponding to other field names in the first table, and the correspondence between the second field value and the field value corresponding to other field names in the second table, the selected field name and the field value corresponding to the selected field name in the first table are merged with the selected field name and the field value corresponding to the selected field name in the second table to obtain a third table.

[0067] In one possible implementation, based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field values ​​corresponding to other field names in the first table, and the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, the first table and the second table are merged to obtain a third table, including:

[0068] In response to the setting operation that sets the first table as the main table, determine the order of at least one field name in the first table and at least one field name in the second table in the merged table;

[0069] Based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field values ​​corresponding to other field names in the first table, the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, and the order of at least one field name in the first table and at least one field name in the second table in the merged table, the first table and the second table are merged to obtain the third table.

[0070] In one possible implementation, based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field values ​​corresponding to other field names in the first table, the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, and the order of at least one field name in the first table and at least one field name in the second table in the merged table, the first table and the second table are merged to obtain a third table, including:

[0071] Based on the order of at least one field name from the first table and at least one field name from the second table in the merged table, add at least one field name from the first table and at least one field name from the second table to the third table;

[0072] Based on the correspondence between the first field value and the field values ​​corresponding to other field names in the first table, the field values ​​of the first table are added to the third table so that the third table includes at least one piece of data;

[0073] For any data in the third table, based on the correspondence between the first field value and the second field value, and the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, find the target data corresponding to the data in the second table, add the target data at the corresponding position in the third table, and mark the target data in the second table.

[0074] After adding target data based on each data entry in the third table, if there is unlabeled data in the second table, then add the unlabeled data in the third table at the position corresponding to at least one field name of the second table.

[0075] In one possible implementation, the method also includes:

[0076] Based on the third table and the fourth table, determine the third field name and the fourth field name that have a relationship. The third field name is the field name in the third table, and the fourth field name is the field name in the fourth table. The third field value corresponding to the third field name corresponds one-to-one with the fourth field value corresponding to the fourth field name.

[0077] Based on the correspondence between the values ​​of the third and fourth fields, the correspondence between the values ​​of the third field and the values ​​of other field names in the third table, and the correspondence between the values ​​of the fourth field and the values ​​of other field names in the fourth table, the third and fourth tables are merged to obtain the fifth table.

[0078] In one possible implementation, obtaining the first table and the second table includes:

[0079] Export the first and second tables from the database management system.

[0080] All of the above-mentioned optional technical solutions can be combined in any way to form the optional embodiments of this application, and will not be described in detail here.

[0081] Figure 2 This is a simplified description of the table merging method in this application's embodiments. (The embodiments of this application are described in detail below.) Figure 3 The illustrated example further illustrates the table merging method. Figure 3 This is a flowchart of a table merging method provided in an embodiment of this application. This embodiment uses a computer device as an example for illustrative purposes. See [link to relevant documentation]. Figure 3 The method includes:

[0082] 301. The computer device exports a first table, a second table, and a fourth table from the database management system. Each table includes at least one field name and at least one piece of data. Each piece of data includes the field value corresponding to the at least one field name, and the field values ​​corresponding to different field names in the same piece of data correspond one-to-one.

[0083] The database management system in this embodiment does not have a join query function. The first table, the second table, and the fourth table are the tables in the database management system that require join queries. It should be noted that this embodiment is only used as an example to illustrate the need to perform join queries in the first table, the second table, and the fourth table. Of course, join queries can also be performed in more or fewer tables. The table merging process is the same, so it will not be described in detail here.

[0084] In some embodiments, the tables exported by the computer device from the data management system are Excel spreadsheets.

[0085] 302. The computer device displays a merge settings interface for a first table and a second table, the merge settings interface including at least one field name in the first table and at least one field name in the second table.

[0086] The merge settings interface is used to set merge parameters for tables. In some embodiments, after a computer device exports a table from a database management system, it directly displays the merge settings interface to set the merge parameters for the exported table. In other embodiments, after exporting a table from the database management system, the computer device needs to perform certain operations to display the merge settings interface.

[0087] Optionally, in response to the merge operation on the first table and the second table, the computer device displays a merge settings interface for the first table and the second table. The merge operation on the first table and the second table can be any operation; for example, it can be a preset operation, such as dragging the table identifier of the first table to the position of the table identifier of the second table, or dragging the table identifier of the second table to the position of the table identifier of the first table, etc. This application embodiment does not limit the merge operation on the first table and the second table.

[0088] Optionally, in response to a triggering operation of the merge option, the computer device displays a merge settings interface. In response to the selection of a first table and a second table in the merge settings interface, the computer device displays at least one field name from the first table and at least one field name from the second table. For example, after opening the first table, the second table, or the fourth table, the computer device displays a table display interface for that table. This table display interface includes the data in the table and at least one option for processing the data in the table. One of the at least one options includes a merge option. After the user clicks the merge option, they can select any local table to merge with this table.

[0089] In this application embodiment, the merge settings interface may have at least one setting function. This application embodiment only provides illustrative examples of the setting functions of the merge settings interface. In some embodiments, the merge settings interface is used to determine the first field name and the second field name that have a relationship in the first table and the second table. In some embodiments, the merge settings interface is used to determine the fields in the first table and the second table that need to be merged. In some embodiments, the merge settings interface is used to determine which table is the main table when merging the first table and the second table.

[0090] 303. In response to an association operation on any field name in the first table and any field name in the second table, the computer device determines the selected field name as the first field name and the second field name that have an association relationship between the first table and the second table.

[0091] The association operation can be any type of triggering operation, and this application embodiment does not limit the association operation. In some embodiments, the merge settings interface includes an association option, and the association operation can be the operation of inputting the first field name and the second field name into the association option. In other embodiments, the association operation can be the operation of selecting the first field name and the second field name.

[0092] In one possible implementation, the first field name and the second field name are field names that are identical and whose corresponding field values ​​are unique identifiers. Therefore, the correspondence between the first field value corresponding to the first field name and the second field value corresponding to the second field name is clear.

[0093] For example, the first table is Table 1 above, and the second table is Table 2 below. The field name that is the same in both the first and second tables and whose corresponding field value is a unique identifier is "Class Number". That is, the first field name is "Class Number" in the first table, and the second field name is "Class Number" in the second table.

[0094] Table 2

[0095] Class number Class Name C1 Class 1, Grade 3 C2 Class 2, Grade 3

[0096] In another possible implementation, the first field name and the second field name are not field names that are identical and whose corresponding field values ​​are unique identifiers. In this case, the computer device is unaware of the correspondence between the first field value corresponding to the first field name and the second field value corresponding to the second field name. Therefore, the user can input the correspondence between the first field value and the second field value. In some embodiments, the table merging method further includes: displaying a correspondence retrieval option in the merging settings interface, which is used to retrieve the correspondence between the field values ​​corresponding to two related field names; and retrieving the correspondence between the first field value and the second field value based on this correspondence retrieval option.

[0097] For example, the first table is Table 1 above, and the second table is Table 2 above. The first field name is "Student ID" in Table 1, and the second field name is "Class Number" in Table 2. Then, the user can enter the correspondence between the field value corresponding to "Student ID" and the field value corresponding to "Class Number" in the merge settings interface.

[0098] It should be noted that the embodiments in this application only illustrate the example of a user setting the first and second field names through a merge settings interface, providing an example of "determining the first and second field names with a relationship based on the first and second tables". In other embodiments, the computer device can also automatically determine the first and second field names. The computer device determines the first and second field names with a relationship in the first and second tables by: identifying the field names in the first and second tables that are identical and whose corresponding field values ​​are unique identifiers as the first and second field names with a relationship.

[0099] 304. In response to a selection operation of at least one field name in the first table and at least one field name in the second table, the computer device merges the selected field name and its corresponding field value in the first table with the selected field name and its corresponding field value in the second table based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field value corresponding to other field names in the first table, and the correspondence between the second field value and the field value corresponding to other field names in the second table to obtain a third table.

[0100] Users can select at least some field names from the first table and the second table to merge. In step 304 above, the field names selected by the user are the field names that need to be merged. In some embodiments, the merge settings interface displays two sets of field names. Each set of field names includes at least one field name from the first table and at least one field name from the second table. One set of field names is used to determine the first and second field names that have a relationship, and the other set of field names is used to determine the fields that need to be merged.

[0101] In one possible implementation, when merging tables, users can select the main table, so that the field names of the main table are listed first in the merged table. A computer device, based on the correspondence between a first field value and a second field value, the correspondence between a first field value and the corresponding field values ​​of other field names in a first table, and the correspondence between a second field value and the corresponding field values ​​of other field names in a second table, merges the selected field name and its corresponding field value in the first table with the selected field name and its corresponding field value in the second table to obtain a third table. This includes: in response to a setting operation that sets the first table as the main table, determining the order of at least one field name in the first table and at least one field name in the second table in the merged table; and based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the corresponding field values ​​of other field names in the first table, the correspondence between the second field value and the corresponding field values ​​of other field names in the second table, and the order of at least one field name in the first table and at least one field name in the second table in the merged table, merging the selected field name and its corresponding field value in the first table with the selected field name and its corresponding field value in the second table to obtain a third table.

[0102] When the first table is the main table, at least one field name from the first table comes first, followed by at least one field name from the second table. Furthermore, the order of the at least one field name in the first table is the same as its order within the first table, and the order of the at least one field name in the second table is the same as its order within the second table. When the second table is the main table, at least one field name from the second table comes first, followed by at least one field name from the first table. Furthermore, the order of the at least one field name in the second table is the same as its order within the second table, and the order of the at least one field name in the first table is the same as its order within the first table.

[0103] Optionally, the computer device, based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field values ​​corresponding to other field names in the first table, the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, and the order of at least one field name in the first table and at least one field name in the second table in the merged table, merges the selected field name and the corresponding field value in the first table with the selected field name and the corresponding field value in the second table to obtain a third table. This includes: the computer device adding the selected field name from the first table and the corresponding field value in the second table to the third table based on the order of at least one field name in the first table and at least one field name in the second table in the merged table. The selected field name in the second table; based on the correspondence between the first field value and the corresponding field values ​​of other field names in the first table, the field values ​​of the first table are added to the third table, so that the third table includes at least one piece of data; for any piece of data in the third table, based on the correspondence between the first field value and the second field value, and the correspondence between the second field value and the corresponding field values ​​of other field names in the second table, the target data corresponding to the data is found in the second table, the target data is added to the corresponding position in the third table, and the target data is marked in the second table; after adding the target data based on each piece of data in the third table, if there is unmarked data in the second table, the unmarked data is added to the corresponding position of the field name in the second table in the third table.

[0104] Specifically, for any data in the third table, based on the correspondence between the first field value and the second field value, and the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, when searching for the target data corresponding to the data in the second table, if multiple target data are found, the data in the third table is copied so that the number of the data in the third table is the same as the number of target data, and then the multiple target data are concatenated into the multiple data.

[0105] For example, the first table is Table 1 above, and the second table is Table 2 above. The first field is named "Class Number" in the first table, and the second field is named "Class Number" in the second table. The selected fields in the first table are named "Student ID", "Name", "Age" and "Class Number", and the selected fields in the second table are named "Class Number" and "Class Name". When merging, the first table is used as the main table, and the resulting third table is Table 3 below:

[0106] Table 3

[0107] Student ID Name age Class number Class Name S1 Xiao Zhang 15 C1 Class 1, Grade 3 S2 Xiao Li 16 C1 Class 1, Grade 3 C2 Class 2, Grade 3

[0108] When merging, the second table is used as the main table, resulting in the third table as shown in Table 4 below:

[0109] Table 4

[0110] Class number Class Name Student ID Name age C1 Class 1, Grade 3 S1 Xiao Zhang 15 C1 Class 1, Grade 3 S2 Xiao Li 16 C2 Class 2, Grade 3

[0111] It should be noted that step 304 above is only an example of merging selected fields to illustrate the merging process. In another embodiment, all fields of the first table and the second table are merged. In one possible implementation, the computer device merges the first table and the second table to obtain a third table based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field value corresponding to other field names in the first table, and the correspondence between the second field value and the field value corresponding to other field names in the second table. This includes: in response to a setting operation that sets the first table as the main table, determining the order of at least one field name in the first table and at least one field name in the second table in the merged table; merging the first table and the second table to obtain a third table based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field value corresponding to other field names in the first table, the correspondence between the second field value and the field value corresponding to other field names in the second table, and the order of at least one field name in the first table and at least one field name in the second table in the merged table.

[0112] Optionally, the computer device merges the first table and the second table to obtain a third table based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field values ​​corresponding to other field names in the first table, the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, and the order of at least one field name in the first table and at least one field name in the second table in the merged table. This includes: the computer device adding at least one field name from the first table and at least one field name from the second table to the third table based on the order of at least one field name in the first table and at least one field name from the second table in the merged table; based on the correspondence between the first field value and the field values ​​corresponding to other field names in the first table... Based on the correspondence between the field values ​​corresponding to other field names, the field values ​​of the first table are added to the third table, so that the third table includes at least one piece of data. For any piece of data in the third table, based on the correspondence between the first field value and the second field value, and the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, the target data corresponding to the data is found in the second table, the target data is added to the corresponding position in the third table, and the target data is marked in the second table. After adding the target data based on each piece of data in the third table, if there is unmarked data in the second table, the unmarked data is added to the third table at the position corresponding to at least one field name of the second table.

[0113] The process of merging all fields of the first table and the second table is the same as merging at least some fields of the first table and the second table, and will not be described in detail here.

[0114] 305. The computer device determines the third field name and the fourth field name that are related based on the third table and the fourth table. The third field name is the field name in the third table, and the fourth field name is the field name in the fourth table. The third field value corresponding to the third field name and the fourth field value corresponding to the fourth field name are in one-to-one correspondence.

[0115] Step 305 above is the same as step 303 in step 302 above, and will not be described in detail here.

[0116] 306. Based on the correspondence between the values ​​of the third field and the fourth field, the correspondence between the values ​​of the third field and the field values ​​corresponding to other field names in the third table, and the correspondence between the values ​​of the fourth field and the field values ​​corresponding to other field names in the fourth table, the computer equipment merges the third table and the fourth table to obtain the fifth table.

[0117] Step 306 is the same as step 304 above, and will not be described in detail here.

[0118] In some embodiments, after obtaining the third or fifth table, the computer device may also store the third or fifth table in a database management system.

[0119] It should be noted that the embodiments in this application are only illustrative examples of merging two tables. In another embodiment, the computer device can merge multiple tables. When merging multiple tables, it is only necessary to determine the field names in each table that are related to any other table. Taking the first table, the second table, and the fourth table as examples, when merging, it is necessary to determine the first field name and the second field name that are related in the first table and the second table, and it is also necessary to determine the two field names that are related in the first table and the fourth table, or the two field names that are related in the second table and the fourth table.

[0120] This application provides a table merging method that can merge two tables into one based on two related field names. This method can be used when the database management system lacks the function of table join query, so that the tables that need to be joined can be merged and queries can be performed in the merged table. This solves the problem caused by the lack of table join query function in the database management system, improves the efficiency of table query and processing, and also improves the flexibility of table query and processing.

[0121] Figure 4 This is a schematic diagram of the structure of a table merging device provided in an embodiment of this application, as shown below. Figure 4 As shown, the device includes:

[0122] The acquisition module 401 is used to acquire a first table and a second table. The table includes at least one field name and at least one piece of data. Each piece of data includes at least one field value corresponding to a field name. The field values ​​corresponding to different field names in the same piece of data correspond one-to-one.

[0123] The determination module 402 is used to determine the first field name and the second field name that have an association relationship based on the first table and the second table. The first field name is the field name in the first table, the second field name is the field name in the second table, and the first field value corresponding to the first field name and the second field value corresponding to the second field name correspond one-to-one.

[0124] The merging module 403 is used to merge the first table and the second table to obtain a third table based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field value corresponding to other field names in the first table, and the correspondence between the second field value and the field value corresponding to other field names in the second table.

[0125] In one possible implementation, the determining module 402 is used to display a merge setting interface for the first table and the second table, the merge setting interface including at least one field name in the first table and at least one field name in the second table; in response to an association operation on any field name in the first table and any field name in the second table, the selected field name is determined as the first field name and the second field name that have an association relationship between the first table and the second table.

[0126] In one possible implementation, the determining module 402 is further configured to display a correspondence acquisition option in the merge settings interface. The correspondence acquisition option is used to acquire the correspondence between the field values ​​corresponding to two field names that have an association relationship. Based on the correspondence acquisition option, the correspondence between the first field value and the second field value is acquired.

[0127] In one possible implementation, the determining module 402 is used to determine the field names in the first table and the second table that have the same field names and whose corresponding field values ​​are unique identifiers as the first field name and the second field name that have an association relationship.

[0128] In one possible implementation, the merging module 403 is used to display a merging settings interface for a first table and a second table. The merging settings interface includes at least one field name in the first table and at least one field name in the second table. In response to a selection operation of at least one field name in the first table and at least one field name in the second table, based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field value corresponding to other field names in the first table, and the correspondence between the second field value and the field value corresponding to other field names in the second table, the selected field name and the field value corresponding to the selected field name in the first table are merged with the selected field name and the field value corresponding to the selected field name in the second table to obtain a third table.

[0129] In one possible implementation, the merging module 403 is used to determine the order of at least one field name in the first table and at least one field name in the second table in the merged table in response to a setting operation that sets the first table as the main table; based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field value corresponding to other field names in the first table, the correspondence between the second field value and the field value corresponding to other field names in the second table, and the order of at least one field name in the first table and at least one field name in the second table in the merged table, the first table and the second table are merged to obtain a third table.

[0130] In one possible implementation, the merging module 403 is used to add at least one field name from the first table and at least one field name from the second table to the third table based on the order of at least one field name from the first table and at least one field name from the second table in the merged table; based on the correspondence between the first field value and the field values ​​corresponding to other field names in the first table, the module adds field values ​​from the first table to the third table, so that the third table includes at least one piece of data; for any piece of data in the third table, based on the correspondence between the first field value and the second field value and the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, the module searches for target data corresponding to the data in the second table, adds the target data at the corresponding position in the third table, and marks the target data in the second table; after adding the target data based on each piece of data in the third table, if there is unmarked data in the second table, the module adds the unmarked data at the position corresponding to at least one field name from the second table in the third table.

[0131] In one possible implementation, the determining module 402 is further configured to determine the third field name and the fourth field name that have an association relationship based on the third table and the fourth table, wherein the third field name is the field name in the third table, the fourth field name is the field name in the fourth table, and the third field value corresponding to the third field name corresponds one-to-one with the fourth field value corresponding to the fourth field name.

[0132] The merging module 403 is also used to merge the third table and the fourth table to obtain the fifth table based on the correspondence between the third field value and the fourth field value, the correspondence between the third field value and the field values ​​corresponding to other field names in the third table, and the correspondence between the fourth field value and the field values ​​corresponding to other field names in the fourth table.

[0133] In one possible implementation, module 401 is used to export a first table and a second table from the database management system.

[0134] It should be noted that the table merging device provided in the above embodiments is only illustrated by the division of the above functional modules when merging tables. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. In addition, the table merging device and the table merging method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0135] Figure 5This diagram illustrates a structural block diagram of a terminal 500 provided in an exemplary embodiment of this application. The terminal 500 includes a processor 501 and a memory 502.

[0136] Processor 501 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 501 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 501 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 501 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 501 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0137] Memory 502 may include one or more computer-readable storage media, which may be non-transitory. Memory 502 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in memory 502 is used to store at least one program code for execution by processor 501 to implement the table merging method provided in the method embodiments of this application.

[0138] In some embodiments, the terminal 500 may also optionally include a peripheral device interface 503 and at least one peripheral device. The processor 501, memory 502, and peripheral device interface 503 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 503 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of the following: a radio frequency circuit 504, a display screen 505, a camera assembly 506, an audio circuit 507, a positioning assembly 508, and a power supply 509.

[0139] Peripheral device interface 503 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 501 and memory 502. In some embodiments, processor 501, memory 502 and peripheral device interface 503 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 501, memory 502 and peripheral device interface 503 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.

[0140] Display screen 505 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 505 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 501 for processing. In this case, display screen 505 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 505, serving as the front panel of terminal 500; in other embodiments, there may be at least two display screens, respectively disposed on different surfaces of terminal 500 or in a folded design; in still other embodiments, display screen 505 may be a flexible display screen, disposed on a curved or folded surface of terminal 500. Furthermore, display screen 505 may be configured as a non-rectangular, irregular shape, i.e., a non-rectangular screen. Display screen 505 may be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).

[0141] Power supply 509 is used to power the various components in terminal 500. Power supply 509 can be AC ​​power, DC power, a disposable battery, or a rechargeable battery. When power supply 509 includes a rechargeable battery, the rechargeable battery can support wired or wireless charging. The rechargeable battery can also be used to support fast charging technology.

[0142] Those skilled in the art will understand that Figure 5 The structure shown does not constitute a limitation on terminal 500, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0143] Figure 6This is a schematic diagram of a server structure provided in an embodiment of this application. The server 600 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 601 and one or more memories 602. The memory 602 stores at least one line of program code, which is loaded and executed by the processor 601 to implement the methods provided in the various method embodiments described above. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated upon here.

[0144] The server 600 is used to execute the steps performed by the server in the above method embodiments.

[0145] This application also provides a computer-readable storage medium storing at least one piece of program code, which is loaded and executed by a processor to implement the table merging method as described in any of the above implementations.

[0146] This application also provides a computer program product, which includes at least one piece of program code that is loaded and executed by a processor to implement the table merging method as described in any of the above implementations.

[0147] In some embodiments, the computer program involved in the present application embodiments may be deployed and executed on a computer device, or executed on multiple computer devices located in one location, or executed on multiple computer devices distributed in multiple locations and interconnected through a communication network. Multiple computer devices distributed in multiple locations and interconnected through a communication network may constitute a blockchain system.

[0148] The above are merely optional embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method of merging tables, characterized by, The method includes: Obtain a first table and a second table. Each table includes at least one field name and at least one piece of data. Each piece of data includes a field value corresponding to the at least one field name. The field values ​​corresponding to different field names in the same piece of data correspond one-to-one. Based on the first table and the second table, determine the first field name and the second field name that have an association relationship. The first field name is the field name in the first table, and the second field name is the field name in the second table. The first field value corresponding to the first field name and the second field value corresponding to the second field name are in one-to-one correspondence. In response to the setting operation of setting the first table as the main table, determine the order of at least one field name in the first table and at least one field name in the second table in the merged table; Based on the order of at least one field name in the first table and at least one field name in the second table in the merged table, at least one field name from the first table and at least one field name from the second table are added to the third table; based on the correspondence between the first field value and the field values ​​corresponding to other field names in the first table, the field values ​​from the first table are added to the third table, so that the third table includes at least one piece of data. For any data in the third table, based on the correspondence between the first field value and the second field value, and the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, the target data corresponding to the data is found in the second table, the target data is added at the position corresponding to the data in the third table, and the target data is marked in the second table; After adding target data based on each data entry in the third table, if there is unlabeled data in the second table, then the unlabeled data is added to the position corresponding to at least one field name in the second table in the third table.

2. The method of claim 1, wherein, The step of determining the first field name and the second field name with a relationship based on the first table and the second table includes: The merge settings interface for the first table and the second table is displayed. The merge settings interface includes at least one field name from the first table and at least one field name from the second table. In response to an association operation on any field name in the first table and any field name in the second table, the selected field name is determined as the first field name and the second field name that have an association relationship between the first table and the second table.

3. The method of claim 2, wherein, After determining the selected field name as the first field name and the second field name with a relationship in the first table and the second table, in response to the association operation on any field name in the first table and any field name in the second table, the method further includes: The merge settings interface displays a correspondence retrieval option, which is used to retrieve the correspondence between the field values ​​corresponding to two field names that have an association relationship. Based on the correspondence, obtain the correspondence between the first field value and the second field value.

4. The method of claim 1, wherein, The step of determining the first field name and the second field name with a relationship based on the first table and the second table includes: The field names in the first table and the second table that have the same field name and whose corresponding field value is a unique identifier are identified as the first field name and the second field name that have an association relationship.

5. The method of claim 1, wherein, The method further includes: The merge settings interface for the first table and the second table is displayed. The merge settings interface includes at least one field name from the first table and at least one field name from the second table. In response to the selection operation of at least one field name in the first table and at least one field name in the second table, based on the correspondence between the first field value and the second field value, the correspondence between the first field value and the field value corresponding to other field names in the first table, and the correspondence between the second field value and the field value corresponding to other field names in the second table, the selected field name and the field value corresponding to the selected field name in the first table are merged with the selected field name and the field value corresponding to the selected field name in the second table to obtain a third table.

6. The method of claim 1, wherein, The method further includes: Based on the third table and the fourth table, determine the third field name and the fourth field name that have an association relationship. The third field name is the field name in the third table, the fourth field name is the field name in the fourth table, and the third field value corresponding to the third field name corresponds one-to-one with the fourth field value corresponding to the fourth field name. Based on the correspondence between the third field value and the fourth field value, the correspondence between the third field value and the field values ​​corresponding to other field names in the third table, and the correspondence between the fourth field value and the field values ​​corresponding to other field names in the fourth table, the third table and the fourth table are merged to obtain the fifth table.

7. The method of claim 1, wherein, The process of obtaining the first table and the second table includes: Export the first table and the second table from the database management system.

8. A table merging apparatus characterized by comprising: The device includes: The acquisition module is used to acquire a first table and a second table. The table includes at least one field name and at least one piece of data. Each piece of data includes the field value corresponding to the at least one field name. The field values ​​corresponding to different field names in the same piece of data correspond one-to-one. The determination module is used to determine, based on the first table and the second table, a first field name and a second field name that have an association relationship, wherein the first field name is a field name in the first table, the second field name is a field name in the second table, and the first field value corresponding to the first field name and the second field value corresponding to the second field name correspond one-to-one. The merging module is used to determine the order of at least one field name in the first table and at least one field name in the second table in the merged table in response to a setting operation that sets the first table as the main table; The merging module is further configured to add at least one field name from the first table and at least one field name from the second table to the third table based on the order of at least one field name from the first table and at least one field name from the second table in the merged table; and to add field values ​​from the first table to the third table based on the correspondence between the first field value and the field values ​​corresponding to other field names in the first table, so that the third table includes at least one piece of data. The merging module is further configured to, for any data in the third table, based on the correspondence between the first field value and the second field value and the correspondence between the second field value and the field values ​​corresponding to other field names in the second table, find the target data corresponding to the data in the second table, add the target data at the position corresponding to the data in the third table, and mark the target data in the second table; The merging module is further configured to, after adding target data based on each piece of data in the third table, add unmarked data to the third table at the position corresponding to at least one field name of the second table if there is unmarked data in the second table.

9. A computer device, comprising: The computer device includes a processor and a memory, the memory storing at least one piece of program code, the at least one piece of program code being loaded and executed by the processor to implement the table merging method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one piece of program code, which is loaded and executed by a processor to implement the table merging method as described in any one of claims 1 to 7.

11. A computer program product, characterised in that, The computer program product includes at least one piece of program code, which is loaded and executed by a processor to implement the table merging method as described in any one of claims 1 to 7.