add sql for table, amend to insert position into db