Abstract:In view of the diversity of SQL query program, an accurate scoring model is presented. First, based on the common standard SQL syntax specification identifier, command clause, the synonym chain and the abstract syntax tree, SQL program is converted into a kind of unified intermediate form, fully eliminating the SQL program syntax and semantic differences. Then, referring to the artificial grading thought, the standardized code is transformed into the token sequence according to grading points, and the improved algorithm for Longest Common Subsequence(LCS) is used to grade the program similarity. The scores are calculated according to the weight of the scoring points, and the error location is given as well. Finally, samples are tested and anglicized to illustrate the effectiveness of the grading model.