Extracting SQL queries from code stage-1