Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to verify the accuracy of SQL query results

2025-01-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Summarize several ideas of checking data in ordinary work

1. Compare the data results of other channels

Query requirements: query the order quantity of the 20190909 day from the Hive side (simple example). You need to verify whether the SQL result is correct.

Verification method: the upstream data source of Hive is Mysql, and there will be some output data for verification on MySQL.

Under the above data flow, if the query result executed by Hive needs to be verified in the case of showing the amount of order data, it can be verified by comparing the data results of the Mysql channel.

The example is relatively simple, but it belongs to an idea and method to verify the results of the data.

2. The total amount of component cumulative comparison

Table structure:

Order ID order date order channel

1 20190808 A

2 20190808 A

3 20190808 B

4 20190808 B

5 20190807 C

5 20190807 C

5 20190807 C

5 20190807 C

5 20190807 C

Query requirements: query daily, each channel order quantity

Verification method: the order quantity of each channel can be accumulated every day to see if it is the same as the total order quantity of the day.

3. Step-by-step verification results (in the case of A left join B left join C)

There are order list, merchandise table, user list.

Query requirements: query electronic products, the details of orders for users under the age of 18

Verification method: when you encounter this kind of query scenario, first use the order table Join goods table to determine the order details and the amount of data that conform to the electronic products, which boils down to the first step of verification.

On the basis of the first step verification, the user table is associated to screen the conditions under which the user is less than 18 years old, and the second part of the verification is carried out.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 291

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report