FIT9132 Introduction to Databases2018 Semester 2Assignment 2 - Monash Library Services (MonLib) Case StudyDue Date:? Wednesday 10th October 2018 5PM (Week 11)The local Monash Municipality maintains several libraries for its residents across the municipality.For each branch, Monash Library Services assigns a branch code (an incremental number for eachbranch with the first branch using a code of 10). The branch name, address and contact phonenumber are also recorded. Each branch is assigned a manager and has a unique phone number.Due to the small size of some of the branches, a particular manager may manage severalbranches. Each manager is assigned a manager id. Monash Library Services record a managersname and contact phone number.Monash Library Services maintain records of current loans of books to borrowers.Each borrower is identified by a unique borrower number. When a borrower first registers to borrowbooks, the branch where they register is recorded as their home branch. The name and address ofeach borrower is held so that communications, such as overdue loan reminders, can be sent whennecessary.The information held about a book includes its Dewey Decimal call no - this call no is used toidentify a particular books details. The title, authors name/s, publishers name, publication year,purchase price, classification (Reference or Fiction), number of pages and edition, if applicable, arerecorded. Each publisher can be assumed to have a unique name. A given book may be written bya number of different authors, however, the library regards a book as only being published by asingle publisher. The library assigns its own unique in-house numerical codes to identify authorsand publishers.A book may cover a number of different subjects which the library wishes to record so thatborrowers can use an online catalogue system to select books by subject as well as title andauthors name.Branches hold copies of a book - each copy is the property of a particular branch and isidentified by the branch number and a branch assigned local id number (these id numbersare repeated at each branch)?. Some book copies are placed on counter reserve, and are notavailable for loan - they may only be used in the library. A flag is added to a book copy to indicate ifit is on counter reserve or not. There may also be other copies of the same title which are availablefor normal loan.When a book copy is borrowed (goes out on loan), the return date is recorded. A record of all loanswhich take place is maintained. When a book is returned from a loan its actual return date isrecorded. Each book copy can be loaned for exactly 4 weeks and must then be renewed to avoid afine.Page 1 of 6Borrowers may reserve books currently out on loan. The date and time on which the reserve wasplaced are recorded. A given book may be reserved by several borrowers, the book is madeavailable based on the order in which the reserve was placed by the borrower.When a borrower returns a book, they may if they wish renew their loan and take the book out for afurther loan period provided the book has not been reserved by another borrower, the renewal issimply treated as a new loan for that borrower. Books must be returned to the branch from whichthey were borrowed (the branch owning the book copy).A model to represent this system has been developed:This model is available on Moodle as a PDF document.You have been supplied with a schema file FIT9132_2018S2_A2_Schema_Start.sql which partiallyimplements the Monash Library model and an insert file FIT9132_2018S2_A2_Insert_Start.sqlwhich inserts some initial sample data. Neither of these files may? be altered in any way?.You have also been supplied with a document FIT9132_2018S2_A2_Solutions.sql - you shouldrename this script by prepending your authcate username to the start of the filename, e.g.,abc123_FIT9132_2018S2_A2_Solutions.sql. This script file will be referred to as your solutionsscript. Within this script there are marked points where each of your solutions must be added.All of the work for assignment 2 will take place in this document so please take great care to keepregular backups, including off your computer, e.g., on Google Drive, so you do not losework?. It is suggested that you place regular backups of this file on to your Google drive.Page 2 of 6Before starting work on the task you ?MUST? complete the header by adding your name etc.,in the solutions script.In completing this assignment you are not permitted to manually:● lookup a value in the database, obtain its primary key or highest or lowest value in acolumn, or● calculate values external to the database eg. on a calculatorand use such values in your answers.You may ONLY use the data provided in the text of the questions.As an example, say you were asked to find the name of the publisher for the book titled HarryPotter and the Cursed Child - you cannot look in the BOOK_DETAIL table and find the pub_id forthe publisher of this book (say 100), and then use the value 100 directly to find the pub_name fromthe PUBLISHER table. Here you can only use the text you were given Harry Potter and theCursed Child.You MUST USE ONLY the values listed for the particular task you are working on in thisdocument. You must ensure that no unnecessary SQL conditions are used in the WHEREclause of your SQL statements.Your answers must recognise the fact that you have been given, with the supplied insert file, only asmall sample snapshot of a multiuser database, as such you must operate on the basis that therewill be more data in all of the tables of the database than you have been given. Your answersmust work regardless of the extra quantity of this extra real data and the fact that multipleusers will be operating in the tables at the same time. You must take this aspect intoconsideration when writing SQL statements.TASK 1: Data Definition [15 + 5 = 20 mks]For this task you are required to complete the following:1.1 Add to your solutions script, the CREATE TABLE and CONSTRAINT definitions whichare missing from the FIT9132_2018S2_A2_Schema_Start.sql script. You MUST? usethe relation and attribute names shown in the data model above to name tables andattributes which you add.1.2 Add the full set of DROP TABLE statements to your solutions script. In completing thissection you must not use the CASCADE CONSTRAINTS clause? as part of yourDROP TABLE statement (you should include the PURGE clause).Before proceeding with Task 2, you must run the file FIT9132_2018S2_A2_Schema_Start.sql(which must not? be altered in any way?) followed by the extra definitions that you added in 1.1above.In a script you can run a section 帮做FIT9132留学生作业、Monash数据库模型作业代写、data编程代做、代写代做数据库编程作业 代做数据库SQLof the script by highlighting the lines you wish to run andselecting the run button. If at any stage your tables are corrupted during working on thisassignment you simply need to run your drop commands from 1.2 above and then rerunFIT9132_2018S2_A2_Schema_Start.sql and your extra definitions that you added in 1.1above.Page 3 of 6TASK 2: Data Manipulation [9 + 1 + 1 = 11 mks]Run the script FIT9132_2018S2_A2_Insert_Start.sql to add some initial data into the tables youhave created so far.For this task you are required to complete the following sub-tasks in the same order they havementioned:2.1 MonLib has just purchased its first 3 copies of a recently released edition of a book.Readers of this book will learn about the subjects Database Design and DatabaseManagement.Some of the details of the new book are:Call Number: 005.74 C822D 2018Title: Database Systems: Design, Implementation, and ManagementPublication Year: 2018Edition: 13Publisher: CengageAuthors: Carlos CORONEL (author_id = 1 ) andSteven MORRIS (author_id = 2)Price: $120You may make up any other reasonable data values you need to be able to add thisbook.Each of the 3 MonLib branches listed below will get a single copy of this book, thebook will be available for borrowing (ie not on counter reserve) at each branch:Caulfield (Ph: 8888888881)Glen Huntly (Ph: 8888888882)Carnegie (Ph: 8888888883)Your are required to treat this add of the book details and the three copies as asingle transaction.2.2 An Oracle sequence is to be implemented in the database for the subsequentinsertion of records into the database for BORROWER table.Provide the CREATE SEQUENCE statement to create a sequence which could beused to provide primary key values for the BORROWER table. The sequence shouldstart at 10 and increment by 1.2.3 Provide the DROP SEQUENCE statement for the sequence object you havecreated in question 2.2 above.Page 4 of 6TASK 3: [6 + 6 + 6 + 6 = 24 mks]The sequence created in task 2 must be used to insert data into the database for the task 3questions. For these questions you may only use the data supplied in this task.You must correctly manage transactions with these tasks.For this task you are required to complete the following sub-tasks in the same order they havebeen mentioned:3.1 Today is 20th September, 2018, add a new borrower in the database. Some of thedetails of the new borrower are:Name: Ada LOVELACEHome Branch: Caulfield (Ph: 8888888881)You may make up any other reasonable data values you need to be able to add thisborrower.3.2 Immediately after becoming a member, at 4PM, Ada places a reservation on a bookat the Carnegie branch (Ph: 8888888883). Some of the details of the book that Adahas placed a reservation on are:Call Number: 005.74 C822D 2018Title: Database Systems: Design, Implementation, and ManagementPublication Year: 2018Edition: 13You may assume:● MonLib has not purchased any further copies of this book, beyond thosewhich you inserted in Task 2.1● that nobody has become a member of the library between Ada becoming amember and this reservation.3.3 After 7 days from reserving the book, Ada receives a notification from the Carnegielibrary that the book she had placed reservation on is available. Ada is very excitedabout the book being available as she wants to do very well in FIT9132 unit thatshe is currently studying at Monash University. Ada goes to the library andborrows the book at 2 PM on the same day of receiving the notification.You may assume that there is no other borrower named Ada Lovelace.3.4 At 2 PM on the day the book is due, Ada goes to the library and renews the book asher exam for FIT9132 is in 2 weeks.You may assume that there is no other borrower named Ada Lovelace.Page 5 of 6TASK 4: [10 + 15 + 20 = 45 mks]For this task you are required to complete the following sub-tasks.After using the system for some time, MonLib has realised that it is necessary to4.1 Record whether a book is damaged (D) or lost (L). If the book is not damaged orlost,then it is good (G) which means, it can be loaned. The value cannot be leftempty for this. Change the live database and add this required information for allthe books currently in the database. You may assume that condition of all existingbooks will be recorded as being good. The information can be updated later, if needbe.4.2 Allow borrowers to be able to return the books they have loaned to any librarybranch as MonLib is getting a number of requests regarding this from borrowers. Aspart of this process MonLib wishes to record which branch a particular loan isreturned to. Change the live database and add this required information for all theloans currently in the database. For all completed loans, to this time, books werereturned at the same branch from where those were loaned.4.3 Some of the MonLib branches have become very large and it is difficult for a singlemanager to look after all aspects of the branch. For this reason MonLib are intendingto appoint two managers for the larger branches starting in the new year - onemanager for the Fiction collection and another for the Non-Fiction collection. Thebranches which continue to have one manager will ask this manager to manage thebranches Full collection. The number of branches which will require two managers isquite small (around 10% of the total MonLib branches). Change the live databaseto allow monLib the option of appointing two managers to a branch and record, forall managers, which collection/s they are managing.In the new year, since the Carnegie branch (Ph: 8888888883) has a huge collectionof books in comparison to the Caulfield and Glen Huntly branches, Robert (Managerid: 1) who is currently managing the Caulfield branch (Ph: 8888888881) has beenasked to manage the Fiction collection of the Carnegie branch, as well as the fullcollection at the Caulfield branch. Thabie (Manager id: 2) who is currently managingthe Glen Huntly branch (Ph: 8888888882) has been asked to manage theNon-Fiction collection of Carnegie branch, as well as the full collection at the GlenHuntly branch. Write the code to implement these changes.SUBMISSION REQUIREMENTSDue Date: Wednesday 10th October 2018 5PM (Week 11)For this assignment there is only one file to submit. You are required to submit your solutions scriptfile to Moodle before the assignment due date/time. If you need to make any comments yourmarker/tutor should be aware of please place them at the head of your solutions script in theComments for your marker: section.Late submission will incur penalties as outlined in the unit guide.转自:http://ass.3daixie.com/2018100163317919.html