Quantcast
Channel: Toad for MySQL
Viewing all articles
Browse latest Browse all 1315

Blog Post: Validate your queries with Toad for MySQL

$
0
0
Love this feature, don’t think it gets enough play I use this one myself pretty regularly, mostly as a sanity check for query results when doing data prep work. The situation is that I have a large amount of user data and I want to reach out to a select few folks to get feedback, but I don’t want to bother them more than once. I won’t bore you with the whole process, but part of it is making sure that my user dataset has unique values (so nobody get contacted twice). So first (maybe out of superstition), I run the query without a GROUP BY clause, just to make sure that the numbers make sense: In this case they do, I have 8389 rows returned (NOTE: Click Images to embiggen) Then, because I get distracted a lot, I name the tab containing the result set so I can remember what data it contains and how it got there. In the screenshot here I’ve right clicked and Renamed the tab ‘No Group By Clause’ onnacounta this query doesn’t have one. Now, I rerun the same query, but this time using a group by clause to (hopefully) get rid of dupes and then rename the result tab the same way. Notice that the group clause seems to have gotten rid of my duplicate records by the record count in the Right hand corner too (5114 records vs 8389) Now the magic, to double check my data, I right click in the result set of either and select the dataset to compare to…in this case comparing the result set ‘Group By Clause’ the ‘No Group By Clause’ result set: Now I choose the column or columns to use to make the comparison…i.e. if I had a unique ‘user_id’ or (ha ha) ‘social_security_number’ field I’d use that. In this case, I have to use a combo and fake it a bit so I’ll choose first name and Subject: And now the payoff, I can visually confirm differences in the datasets and be confident that my group by clause had the desired effect of removing dupes. In this example, the user ‘A’ downloaded Toad for SQL Server two times, but as expected, the record is returned only once in the ‘Group BY Clause’ result set, but twice in the ‘No Group By Clause’ Dataset, meaning my query had the desired result, and only unique values are returned. Feels great to have data I can trust! Learn more about Toad for MySQL on Toad World

Viewing all articles
Browse latest Browse all 1315

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>