add sql and tests
sql script