Update sql statements to work with modified tables.