I was supplied with an SQL script mlib_initialSchemaInsert.sql which partially implements the MLib model (represented on the diagram above). It creates the tables colored in purple and inserts some initial sample data.
Adding the CREATE TABLE and CONSTRAINT definitions which are mission from the supplied partial schema script.
Adding the full set of DROP TABLE statements, that drops all the tables created by the supplied partial schema script and tables created in T1-ml-schm.sql, as well as the ones that are created in HI ADD HERE
Loading the BOOK_COPY, LOAN and RESERVE tables with my own test data:
- 10 BOOK_COPIES:
- representing at least 3 different book details,
- distributed across 3 different libraries,
- with at least 1 library holding multiple copies of a book,
- at least one copy on counter reserve
- 10 LOANS:
- 8 of which must have been completed, with at least one of these returned late and one still due,
- borrowed from at least 2 different libraries,
- by at least 3 different borrowers
- 2 RESERVE entries
The inserted data conforms to the following rules:
- All the data is treared as a single transation
- The primary key values for this data are hardcoded values
- Date used is chosen between the 1st June 2021 and 13th September 2021 (inclusive).
Adding new data and modifying the existing data accordingly
Making changes to the "live" database created before.
Files are to be run in the following order:
- T1-ml-drop.sql (not needed for the first time run)
- mlib_initialSchemaInsert.sql
- T1-ml-schm.sql
- T2-ml-insert.sql
- T2-ml-dm.sql
- T3-ml-alter.sql