Extracting SQL queries from code stage-4