This HW uses the books database from the book "SQL, Visual Quickstart Guide, 2nd edition" by Fehily. The following is the ERD for the database. See page 39 in the book for more information about the tables.
Publishers often have a multi-tiered royalty system. For example for the first 1000 books sold the author might get a certain royalty rate. For every book after the 1000th, the royalty rate might double. For example for one book, the author might get 9% for the first 1000 books sold and 18% for all subsequent sales. For another book the author might get 10% for the first 1000 books and 20% for all subsequent sales.
Write a trigger that doubles the royalty rate for a book when the sales for that book surpasses 1000. Specifically, when the "sales" column in the "titles" table for a particular row is updated from a value that was <= to 1000 to a value that is > 1000 the trigger should double the value of the "royalty_rate" column in the "royalties" table for the appropriate row .