Update SQL file to create schema from ERD.
Fixed error handling.