DBMSII-PracBook-Ass1.pdf

Embed Size (px)

Citation preview

  • 7/29/2019 DBMSII-PracBook-Ass1.pdf

    1/5

    Student Reg. No. :

    Student Name :

    Campus :

    Department of Information Technology

    Faculty of Computing

    Sri Lanka Institute of Information Technology

    SRI LANKA INSTITUTE OF INFORMATION TECHNOLOGY

    Database Management

    Systems II (IT202)Practical Workbook

    Year 2 - Semester II

    2012

  • 7/29/2019 DBMSII-PracBook-Ass1.pdf

    2/5

    Instructions to students:

    This book must be brought for all the practical classes. The attached grading sheet complete with instructor recommendations must be handed

    over at the time of the viva.

    This book consists of three Assignments. Complete the assigned exercises as part of theassignments on a weekly basis.

    Demonstrate to the lab instructor that the work has been done during each practicalsession and complete the grading sheet. Otherwise, it will be considered as not attempted

    in class.

    All answers should be written by hand. Do not attach printed answers to the book exceptotherwise state so.

    A copy of each completed assignment must be uploaded into the course web available athttp://moodle.sliit.lk

  • 7/29/2019 DBMSII-PracBook-Ass1.pdf

    3/5

    Laboratory Assignment 1

    Session 1-2

    Objective: Designing E-ER Models for data requirements.

    The requirements for the Academic library are outlined below:

    Item information

    The library contains a list of Items Every Item has an item_no, title, and a description Every Item is identified by the item number Items are classified into the following categories: Books, Periodicals, and Software &

    Manuals

    Every Book has one or many Authors Every Author has an author_id, last name, first name, and other names. An Author could

    have written one or many books.

    Every Periodical has a publisher and a frequency (e.g., daily, weekly, monthly, quarterlyand yearly)

    Every Software & Manuals has a manufacturer and a version Books are further classified as Text Books and Published Books Periodicals are classified into Magazines and Newspapers Every Text Book has a semester, year and section (such as lecture, lab or tutorial) Every Published Book has an edition Published Book has a Published Book Type depending on publisher of the book (for

    example, same book can be published by different publishers such as US print by

    McGrawHill and Indian print of the book by TATA McGrawHill)

    Published Book Type is identified by ISBN number. Also, Published Book Type containsPublisher, Cover (softback or hardback) and Year Published.

    Periodicals also has a Periodical Type which contains the date the issue was published(for example, November issue of Sports Illustrated).

    The items, (i.e. Text Book, Published Book Type, Periodical Type and Software &Manuals), can have multiple copies.

    Each Copy of Item is identified by the access_no. Copy of Item contains a status field which indicates whether the book is borrowed, lost,

    stolen or available.

    Member information

    There are members of the academic library. Every Member is grouped into different Member_Types (i.e. Senior Lecturer, Lecturer,

    Assistant Lecturer, Instructor, Administrators, CSD, Guests)

    Every Member has a library_id (which is unique), last name, first name, other name,phone, location, e-mail, address, password, and remarks

  • 7/29/2019 DBMSII-PracBook-Ass1.pdf

    4/5

    Location contains the campus, floor number, and office numberLoan information

    Members loan Copy of Items Loan information includes datetime_borrowed, due_date, date_returned, fine, and

    whether the fine was paid (yes, no)

    Partial payments are allowed for a fine and each payment has a unique payID, amountand the date paid.

    Draw an Extended Entity Relationship (E-ER) diagram for the above mentioned data

    requirements.

    Session 3

    Objective: Mapping E-ER Model to Relational Model

    Use model answer given during the practical session for the library data requirements. Convert

    the E-ER diagram to relational schema.

    Session 4

    Objective: Use of normalization to refine the relational schema

    For the library relational schema (presented in session 3s answer), do the following:

    1. Identify the keys for each relation2. State the functional dependencies for each relation3. Convert the relational schema to Boyce-Codd Normal Form (BCNF)

  • 7/29/2019 DBMSII-PracBook-Ass1.pdf

    5/5

    Session 5

    Objective: DDLs in T-SQL

    Create the relational schemas in session 4 using T-SQL.

    Write your script and save your answer as Library.sql file. Use appropriate data types for columns of table. The following constraints exist for the schema. Use appropriate constraint mechanism

    (such as CHECK constraint, etc.) to enforce the rules stated:

    Library Schema:

    The title attribute ofBooks, Periodicals and Software_Manuals cannot contain a nullvalue.

    Ensure that item_no of Books, Periodicals, Software_Manuals start with B, P, Srespectively

    Use IDENTITY property for author_id attribute of Authors table to ensure that aunique id is generated for authors.

    Ensure that Magazine or Newspaper are the only allowed values fortype attributein Periodicals table.

    Ensure that the book_section attribute ofText_Books can be only Lecture, Lab, orTutorial values.

    Ensure that theyearattribute ofText_Books is between 1999 and 3000. Ensure that the coverattribute ofPublished_Book_Typecan only have Soft Cover

    or Hard Cover values.

    Ensure that the yr_publishedattribute ofPublished_Book_Type is between 1000 and3000.

    Ensure that the statusattribute of Copy_Item is only Borrowed, Lost, Stolen orAvailable.

    Ensure that the library members last name is not null. The default value for datetime_borrowed descriptive attribute of the loan

    relationship should be the system date.

    End of Assignment 1