The following tables are part of a librarys database system. Book (book id, title, number owned, number
Question:
The following tables are part of a library’s database system. Book (book id, title, number owned, number borrowed) Person(person id, name, address) Borrowed(person id, book id, number) The primary keys of each table are in bold. In the table, Book the column number owned is the number of copies of the book owned by the library, while the column number borrowed is the number of copies currently out on loan. In table Borrowed the column person id is a foreign key into the Person table, and the column book id is a foreign key into the Book table. The column number is the number of copies of the book borrowed by the associated person. (This library is used by primary school teachers who frequently check out many copies of a book for use in their classes.) If the database is internally consistent, then the column number borrowed is redundant information that can be computed from the actual number borrowed, and this can be derived from the Borrowed table.
(a) Write an SQL query that checks the internal consistency of this database. It should return records of the form (book id, number borrowed, actual number borrowed) only for those books where the number borrowed and the actual number borrowed are not equal. ThatIi, if the database is consistent the query will return no records.
Applied Regression Analysis and Other Multivariable Methods
ISBN: 978-1285051086
5th edition
Authors: David G. Kleinbaum, Lawrence L. Kupper, Azhar Nizam, Eli S. Rosenberg