Supercharge Your Innovation With Domain-Expert AI Agents!

Data query method and device, server and storage medium

A data query and data technology, applied in the computer field, can solve problems such as cumbersome, unsupported, and complicated processes, and achieve the effect of expanding usage scenarios and reducing the number of rules written

Active Publication Date: 2019-09-10
SHANGHAI DAMENG DATABASE
View PDF12 Cites 6 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] The GROUP BY clause in the SQL statement is used to group the query results according to the specified grouping items. However, in actual application, it is impossible to guarantee that each structural expression of the SQL statement satisfies the usage rules of the grouping items of the GROUP BY clause. When using a rule, an error is automatically reported: "It is not a GROUP BY expression", and the administrator needs to check and correct the SQL statement, and check the correctness and equivalence of the rewritten SQL statement. The actual application program contains a large number of SQL statements, and The logic of the SQL statement is complex, and the cost of checking the validity of the SQL statement one by one is too high, and the process is too complicated and cumbersome
Moreover, in actual application scenarios, users may want to use non-GROUP BY clause expressions in SQL query statements, but they are restricted by rules and do not support

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Data query method and device, server and storage medium
  • Data query method and device, server and storage medium
  • Data query method and device, server and storage medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0025] figure 1 It is a flow chart of a data query method provided by Embodiment 1 of the present invention. This embodiment is applicable to the situation where SQL statements are grouped and queried. This method can be executed by the data query device provided by this embodiment. The device can use implemented in software and / or hardware. see figure 1 , the method specifically includes the following steps:

[0026] Step 110, acquiring a query statement for data query.

[0027] For data query, it is inseparable from Structured Query Language (SQL), which is a language with strong query ability. For data in relational databases (oracle, db2, sqlserver, sybase, mysql, etc.), through The standard syntax of SQL can be found out.

[0028] Optionally, the query statement may be a SELECT query item clause in the SQL language. The SELECT query item clause can extract data based on specific columns of the data table, and store the extracted results in a result set. However, for...

Embodiment 2

[0046] On the basis of the above embodiments, the steps of performing data query according to the target query statement are further refined, such as figure 2 as shown, figure 2 It is a flowchart of a data query method in Embodiment 2 of the present invention, specifically including the following steps:

[0047] Step 1302, based on the target query statement, determine the target data table for data query;

[0048] Optionally, the target query statement is parsed by a syntax analyzer to obtain a corresponding target data table.

[0049] On the basis of the above embodiments, take the target query statement: SELECT AGGR_NEW(ID), PID FROM TESTGROUP BY PID, as an example. After being analyzed by the syntax analyzer, the corresponding target data table is TEST.

[0050] Step 1304, extract the column data of the grouping object and the entry corresponding to each first parameter value from the target data table, and obtain the first data table.

[0051] Specifically, the colu...

Embodiment 3

[0083] image 3 A schematic structural diagram of a data query device provided in Embodiment 3 of the present invention, as shown in image 3 As shown, the device includes:

[0084] Query sentence obtaining module 310, used for obtaining the query sentence used for data query;

[0085] The target statement acquisition module 320 is used to convert the query statement to obtain the target query statement when the query statement does not meet the set expression rules;

[0086] The data query module 330 is configured to perform data query according to the target query statement.

[0087] In the embodiment of the present invention, the query statement used for data query is obtained; when the query statement does not meet the set expression rules, the query statement is converted to obtain the target query statement; and the data query is performed according to the target query statement. Realize automatic conversion of wrong query statements that do not conform to the rules o...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The embodiment of the invention discloses a data query method and device, a server and a storage medium. The data query method comprises the following steps: acquiring a query statement for data query; when the query statement does not meet the set expression rule, converting the query statement to obtain a target query statement; and performing data query according to the target query statement.The error query statement which does not conform to the grouping query use rule is automatically converted into the correct expression, the converted grouping data query result is returned, the grouping query use scene is expanded, and the query statement compiling rule is reduced.

Description

technical field [0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a data query method, device, server and storage medium. Background technique [0002] Structured Query Language (SQL) is a database query and programming language that can be used for data access, query, update and management of relational database systems, and is widely used in various fields. [0003] The GROUP BY clause in the SQL statement is used to group the query results according to the specified grouping items. However, in actual application, it is impossible to guarantee that each structural expression of the SQL statement satisfies the usage rules of the grouping items of the GROUP BY clause. When using a rule, an error is automatically reported: "It is not a GROUP BY expression", and the administrator needs to check and correct the SQL statement, and check the correctness and equivalence of the rewritten SQL statement. The actual applic...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F16/242
CPCG06F16/244G06F16/2448
Inventor 望声宜朱仲颖
Owner SHANGHAI DAMENG DATABASE
Features
  • R&D
  • Intellectual Property
  • Life Sciences
  • Materials
  • Tech Scout
Why Patsnap Eureka
  • Unparalleled Data Quality
  • Higher Quality Content
  • 60% Fewer Hallucinations
Social media
Patsnap Eureka Blog
Learn More