Making SQL Queries Better

by Andrew M
The article I read this week was entitled “Generating Test Data for Killing SQL Mutants: A Constraint-based Approach” by Shetal Shah, S. Sudarshan, Suhas Kajbaje, Sandeep Patidar, Bhanu Pratap Gupta and Devang Vira. This article talks about how extremely advanced and complicated SQL queries are being created all the time and how difficult it is to test these queries. While SQL queries are always tested before being used sometimes it is very hard to test these queries enough to make sure they will always give the desired results. The authors propose that a method called Mutant Testing be used. In effect, by applying Mutant Testing to test SQL queries testers will be able to show if the query will give the desired results. In Mutant Testing the algorithm of a specific query is changed slightly and the query is ran to test if the results come back the same. If the results are different, as they should be, then this in affect proves that the query is written correctly. While testing every possible mutation of a single query would be extremely time consuming. The authors propose making mutations that would test common programming errors. This would test more efficiently and would not just be testing every possible circumstance.

I found this article very interesting. While I do not have personal experience with testing SQL queries, I feel that this method could really determine if a query was written right. I can agree to a certain extent though because when I was taking my Java classes I would sometimes use mutant testing to make sure that the data would come out as desired. This proved to be very helpful in testing if my code was written correctly and would in essence show a difference of results when the algorithm or statement was mutated.

While I did like this article, I felt it was overly complicated at times. Much of the article was spent showing mutations of SQL query algorithms which I found to be a little overwhelming. I would suggest others to read this article but to be prepared for the complexity of it.


Shah, S.; Sudarshan, S.; Kajbaje, S.; Patidar, S.; Gupta, B.P.; Vira, D.; , “Generating test data for killing SQL mutants: A constraint-based approach,” Data Engineering (ICDE), 2011 IEEE 27th International Conference on , vol., no., pp.1175-1186, 11-16 April 2011


One thought on “Making SQL Queries Better

  • November 4, 2012 at 5:14 pm

    This is a very interesting article, and I am interested in learning more about these test methods the author speaks about. I too am not very knowledgable in testing SQL, so I would simple use a simliar approach as I have done with Java code. However, I do not think the testing done for a java code would be the same as for SQL and viceversa, so it is nice to see some methods of testing for SQL. Good Post!

Comments are closed.