Question

In: Computer Science

3. (15 marks) a. Design a simple normalized Library database for tracking “customers reserve books” with...

3.

a. Design a simple normalized Library database for tracking “customers reserve books” with not more than 3 tables and answer the following questions about your database.

b. Discuss how your database is in third normal form using functional dependencies (FDs).

c. Create an instance of your database.

d. Provide one external level view query in English on your database.

Solutions

Expert Solution

3( a)

Database for tracking “customers reserve books” in library

Customer(Customer_ID,Customer_Type,Name,address,phone)
Book(Book_Id,Author,title,price,available)
Reserve(Book_Id,Customer_Id,Reserve_Date,expiry__Date)

3) b)

Normalization:

In DBMS, normalization is the process of arranging and adjusting data so that data does not contain insert,update and delete anomalies.

First normal form:

  • For the table to be in 1NF, table should contain single atomic attributes. Which means each field does not contain multiple values.
  • To decide the table to be in 1NF, table should contain data. Make sure while filling data enter automic values.

Second normal form:

  • For the table to be in 2NF, that table must be in 1NF and it it has no partial dependency. Which means no non prime attribues are dependent on subset of candidate key or composite key.
  • Composite key or Candidate key: Composite key is nothing but the combination of two or more keys in any table which can be used to identify the records uniquely.

Let us check weather tables are in 2NF:

Customer(Customer_ID,Customer_Type,Name,address,phone)

Candidate key: {Customer_ID}
Non_prime attributes:{Customer_Type,Name,address,phone}

In Customer table, non_prime attributes {Customer_Type,Name,address,phone} dependent on {Customer_ID} which is a complete candidate key.So that this table satisfies 2NF.

Book(Book_Id,Author,title,price,available)

Candidate key: {Book_Id}
Non_prime attributes:{Author,title,price,available}

In Book table, non_prime attributes {Author,title,price,available} dependent on {Book_Id} which is a complete candidate key.So that this table satisfies 2NF.


Reserve(Book_Id,Customer_Id,Reserve_Date,expiry__Date)

Candidate key: {Book_Id,Customer_Id,Reserve_Date}
Non_prime attributes:{expiry__Date}

In Reserver table, non_prime attribute {expiry__Date} dependent on {Book_Id,Customer_Id,Reserve_Date} which is a complete candidate key.So that this table satisfies 2NF. Here {Book_Id,Customer_Id } acts as both primary keys and foreign keys.

So above tables are in 2NF.


Third Normal form:

  • For the table to be in 3NF, that table must be in 2NF and there it doesn't have any transitive dependency.
  • Transitive dependency : If A-->B and B-->C then A-->C. So in 3NF tables doesn't contain such relations.
  • After applying 2NF, resulted tables does not contain transitive dependency.So that these tables are satisfying 3 NF.

3 (c)Create an instance of your database:

Customer(Customer_ID,Customer_Type,Name,address,phone)
Book(Book_Id,Author,title,price,available)
Reserve(Book_Id,Customer_Id,Reserve_Date,expiry_Date)


Creating instace:

CREATE database customers_reserve_books;

Creating tables:

CREATE TABLE Customer(
Customer_ID int NOT NULL,
Customer_Type VARCHAR(40),
Name VARCHAR(80),
Address VARCHAR(255),
Phone VARCHAR(20),
PRIMARY KEY (Customer_ID)
);

CREATE TABLE Book(
Book_ID int NOT NULL,
Title VARCHAR(255),
Author VARCHAR(125),
Price REAL(6,2),
available CHAR(Y/N),
PRIMARY KEY (Book_ID)
);

CREATE TABLE Reserve(
Customer_ID int NOT NULL,
Book_ID int NOT NULL,
Reserver_Date DATE,
expirt_Date DATE,
PRIMARY KEY (Customer_ID),
PRIMARY KEY (Book_ID),
PRIMARY KEY (Reserver_Date),
FOREIGN KEY (PersonID) REFERENCES Persons(PersonID),
FOREIGN KEY (Book_ID) REFERENCES Book(Book_ID )
);

d. Provide one external level view query in English on your database.

CREATE VIEW CUSTOMER_CONTACT AS SELECT Customer_Name, phone FROM  CUSTOMER;

Above statement is an example of views in database, I have created a view CUSTOMER_CONTACT which stores only Customer_Name & phone from Customer Table.


Related Solutions

One of the characteristics of good relational database design is normalized tables. Discuss two ways in...
One of the characteristics of good relational database design is normalized tables. Discuss two ways in which normalization helps minimize data redundancy and anomalies such as insertion, deletion, and update anomalies. What are some other characteristics of good database design?
Design a simple database to track people and who they voted for. The database should have...
Design a simple database to track people and who they voted for. The database should have 3 tables: A table of candidates A table of registered voters A table of votes The candidate table should provide a listing of all candidates and information about the candidates. The registered voter table should hold all registered voters and any pertinent information about them The vote table should hold vote records for each candidate made by the voters Requirements: The system should not...
Creating a Database Design Lab 1: Creating a Database Design (Wk 3) - OR - Draw...
Creating a Database Design Lab 1: Creating a Database Design (Wk 3) - OR - Draw with pencil and paper diagram (take photo of it and submit) along with a summary of the diagram you prepared in a Word document. Use the scenario from Assignment 1: Business Rules and Data Models to complete the lab: Suppose a local college has tasked you to develop a database that will keep track of students and the courses that they have taken. In...
A county library in Minnesota reported the following number of books checked out in 15 randomly...
A county library in Minnesota reported the following number of books checked out in 15 randomly selected months: 5,176 6,005 5,052 5,310 4,188 4,132 5,736 5,381 4,983 4,423 5,002 4,573 4,209 5,611 4,568 Determine the range, variance, and standard deviation for the sample data.
You are asked to design a relational database for a simple course registration software application for...
You are asked to design a relational database for a simple course registration software application for your school. The relational database must have the following information about the student, the course, and the registration, respectively StudentID, FirstName, LastName, DataOfJoining, and Major CourseNumber, CourseName,InstructorName, StartDate, EndDate, NumberOfCredits ReferenceID, StudentID,CourseID, DateOfRegistration Apply the following constrains while designing the database Each student in the database must be uniquely identifiable Each course listed in the database must be have unique CourseNumber Each course registration...
Assignment 7: Congressional Vote Tracking Database Description Design an Extended E-R schema diagram for keeping track...
Assignment 7: Congressional Vote Tracking Database Description Design an Extended E-R schema diagram for keeping track of information about votes taken in the U.S. House of Representatives and Senate during the current two-year congressional session.  The database needs to keep track of each U.S. STATE's Name (e.g. Texas, New York, Pennsylvania, etc.) and include the Region of the state (whose domain is {North-east, Midwest, Southeast, West}).  Each CONGRESSPERSON in the House of Representatives is described by his or her Name, plus the...
Describe a simple database of your choice or design, along with the table/s representing the data,...
Describe a simple database of your choice or design, along with the table/s representing the data, and illustrate the Insertion Anomaly through the real data or records there. Your database should be different from those already covered in the lectures or practicals.
Please use the books database pasted under question 4 to design the following SQL queries. Use...
Please use the books database pasted under question 4 to design the following SQL queries. Use any method such as subqueries, equi-join/inner-join, outer join, EXISTS 1. Find the name(s) of the publisher(s) who have published the computer book. 2. Find the name(s) of the author(s) that have authored more than one books. 3. Find the name(s) of the publisher(s) who published the least expensive book. 4. Find the name(s) of the author(s) who wrote the book with the greatest number...
Please use the books database pasted under question 4 to design the following SQL queries. Use...
Please use the books database pasted under question 4 to design the following SQL queries. Use any method such as subqueries, equi-join/inner-join, outer join, EXISTS 1. List the title_name and book type of the books that are published earlier than the earliest biography book 2. List the title_name and book type of the books published by 'Abatis Publishers' 3. Find the name(s) of the publisher(s) that have not published any book 4. Find the name(s) of the publisher(s) who have...
Today BandN book stores is currently running a deal on e-books. Customers will receive a 15%...
Today BandN book stores is currently running a deal on e-books. Customers will receive a 15% discount off their entire order. Customers who buy 20 or more e-books will receive 20% off instead. Each book costs a flat $8.99. Write a C++ program that will calculate the final cost of your order, using functions. Global variables are not allowed unless they are constant. Information should be passed with parameters. Your main function should not do any of the tasks in...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT