Draft: modifying sql.
Updated IMS schema with resource* tables.
Draft sql.