New and improved SQL queries
merging