Added SQL generation