Database Concepts: Answers to Questions 1-4
VerifiedAdded on 2023/04/24
|8
|832
|240
AI Summary
This document provides answers to questions related to database concepts including functional dependencies, BCNF, SQL queries, and database design. It also includes a bibliography.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
Running head: DATABASE CONCEPTS
Database concepts
Name of the Student:
Name of the University:
Author Note
Database concepts
Name of the Student:
Name of the University:
Author Note
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
1
DATABASE CONCEPTS
Answer to question number 1
1.1)
{LoanID}+ = {memberID, BookID}
1.2)
MemberID -> MemberFirstName, MemberLastName, Address, PostCode
Address PostCode
LoanID MemberID, BookID, LoanDate, ReturnDate
MemberID, BookID LoanID, LoanDate, ReturnDate
BookID Title, Year, PublisherID
PublisherID PublisherName
AuthorID AuthorFirstName, AuthorLastName
PublisherID, Title Year
Therefore MemberID -> Address, PostCode
Therefore, MemberID is the candidate key.
LoanID MemberID, BookID,
Therefore, LoanID is the candidate key.
BookID PublisherID
Therefore, BookID is the candidate key.
AuthorID AuthorFirstName, AuthorLastName
Therefore AuthorID is the candidate key.
DATABASE CONCEPTS
Answer to question number 1
1.1)
{LoanID}+ = {memberID, BookID}
1.2)
MemberID -> MemberFirstName, MemberLastName, Address, PostCode
Address PostCode
LoanID MemberID, BookID, LoanDate, ReturnDate
MemberID, BookID LoanID, LoanDate, ReturnDate
BookID Title, Year, PublisherID
PublisherID PublisherName
AuthorID AuthorFirstName, AuthorLastName
PublisherID, Title Year
Therefore MemberID -> Address, PostCode
Therefore, MemberID is the candidate key.
LoanID MemberID, BookID,
Therefore, LoanID is the candidate key.
BookID PublisherID
Therefore, BookID is the candidate key.
AuthorID AuthorFirstName, AuthorLastName
Therefore AuthorID is the candidate key.
2
DATABASE CONCEPTS
PublisherID, Title Year
Therefore publisherID is the candidate key.
1.3)
BookID -> PublisherID
Loan ID -> BookID, memberID
The minimal basis for the functional dependencies are
{LoanID, AuthorID}
1.4)
The Relation is in BCNF as the database provides the extended transitive
dependency as per the description shown below:
Loan ID -> BookID, memberID
BookID -> PublisherID
MemberID -> MemberFirstName, MemberLastName, Address, PostCode
Address -> PostCode
LoanID -> MemberID, BookID, LoanDate, ReturnDate
MemberID, BookID -> LoanID, LoanDate, ReturnDate
BookID -> Title, Year, PublisherID
PublisherID -> PublisherName
AuthorID -> AuthorFirstName, AuthorLastName
PublisherID, Title -> Year
DATABASE CONCEPTS
PublisherID, Title Year
Therefore publisherID is the candidate key.
1.3)
BookID -> PublisherID
Loan ID -> BookID, memberID
The minimal basis for the functional dependencies are
{LoanID, AuthorID}
1.4)
The Relation is in BCNF as the database provides the extended transitive
dependency as per the description shown below:
Loan ID -> BookID, memberID
BookID -> PublisherID
MemberID -> MemberFirstName, MemberLastName, Address, PostCode
Address -> PostCode
LoanID -> MemberID, BookID, LoanDate, ReturnDate
MemberID, BookID -> LoanID, LoanDate, ReturnDate
BookID -> Title, Year, PublisherID
PublisherID -> PublisherName
AuthorID -> AuthorFirstName, AuthorLastName
PublisherID, Title -> Year
3
DATABASE CONCEPTS
1.5)
Writer is not minimized hence, the minimization:
Writer (WriterID, AuthorID, BookID)
Answer to question number 2
2.1)
Select Star.starName, COUNT(movStar.mvNumb) from
Star Inner Join movStar On Star.starNumb = MovStar.starNumb
Group By Star.starName
Order By Star.starName;
2.2)
a)
Select star.starName, COUNT(movStar.mvNumb) from
Star Left Outer Join movStar On Star.starNumb = MovStar.starNumb
Group By Star.starName
Order By Star.starName;
b)
Select StarName From Star
Where starNumb NOT IN (Select StarNumb from movStar) OR starNumb IN (Select
StarNumb from movStar);
2.3)
DATABASE CONCEPTS
1.5)
Writer is not minimized hence, the minimization:
Writer (WriterID, AuthorID, BookID)
Answer to question number 2
2.1)
Select Star.starName, COUNT(movStar.mvNumb) from
Star Inner Join movStar On Star.starNumb = MovStar.starNumb
Group By Star.starName
Order By Star.starName;
2.2)
a)
Select star.starName, COUNT(movStar.mvNumb) from
Star Left Outer Join movStar On Star.starNumb = MovStar.starNumb
Group By Star.starName
Order By Star.starName;
b)
Select StarName From Star
Where starNumb NOT IN (Select StarNumb from movStar) OR starNumb IN (Select
StarNumb from movStar);
2.3)
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
4
DATABASE CONCEPTS
Select Movie.mvNumb, Movie.mvTitle, COUNT(movStar.mvNumb) from
Movie Inner Join movStar On Movie.mvNumb = MovStar.mvNumb
HAVING COUNT(movStar.mvNumb)> 2 OR COUNT(movStar.mvNumb) = 2
Group By Movie.mvNumb, Movie.mvTitle
Order By Movie.mvNumb;
2.4)
Select Star.starName, movStar.mvNumb from
Star
Inner Join movStar On Star.starNumb = MovStar.starNumb
Inner Join (Select Star.starName, movStar.mvNumb from
Star Inner Join movStar On Star.starNumb = MovStar.starNumb) As a ON movStar.mvNumb
= a.mvNumb;
2.5)
Select * From (Select Director.dirName, COUNT(Movie. mvNumb) From Director
Inner Join Movie On Director.dirNumb = Movie.dirNumb
Group by Director.dirName
Order By COUNT(Movie. mvNumb) DESC)
Where ROWNUM = 1;
2.6)
Select Member.mmbNumb, Member.mmbName
DATABASE CONCEPTS
Select Movie.mvNumb, Movie.mvTitle, COUNT(movStar.mvNumb) from
Movie Inner Join movStar On Movie.mvNumb = MovStar.mvNumb
HAVING COUNT(movStar.mvNumb)> 2 OR COUNT(movStar.mvNumb) = 2
Group By Movie.mvNumb, Movie.mvTitle
Order By Movie.mvNumb;
2.4)
Select Star.starName, movStar.mvNumb from
Star
Inner Join movStar On Star.starNumb = MovStar.starNumb
Inner Join (Select Star.starName, movStar.mvNumb from
Star Inner Join movStar On Star.starNumb = MovStar.starNumb) As a ON movStar.mvNumb
= a.mvNumb;
2.5)
Select * From (Select Director.dirName, COUNT(Movie. mvNumb) From Director
Inner Join Movie On Director.dirNumb = Movie.dirNumb
Group by Director.dirName
Order By COUNT(Movie. mvNumb) DESC)
Where ROWNUM = 1;
2.6)
Select Member.mmbNumb, Member.mmbName
5
DATABASE CONCEPTS
From Member
Inner Join Borrow On Borrow.mmbNumb = Member.mmbNumb
Where Borrow. mvNumb IN (Select mvNumb from Movie where yrMde > 1970);
Answer to question 3
Answer to question number 4
4.1)
Username -> password, address
Bidno -> date, time, amount, status
itemID -> description
itemID, username -> startingprice, closingDate
usersname -> state, country, businessNo
businessno -> address
title -> subcategory
DATABASE CONCEPTS
From Member
Inner Join Borrow On Borrow.mmbNumb = Member.mmbNumb
Where Borrow. mvNumb IN (Select mvNumb from Movie where yrMde > 1970);
Answer to question 3
Answer to question number 4
4.1)
Username -> password, address
Bidno -> date, time, amount, status
itemID -> description
itemID, username -> startingprice, closingDate
usersname -> state, country, businessNo
businessno -> address
title -> subcategory
6
DATABASE CONCEPTS
username,itemID -> rating, Comment
4.2)
Users (UserName (pk), Password, Address)
Buyer (BuyerID (pk), username (fk))
Seller (SellerID(pk), businessno (fk), username (fk), Sate, Country)
Bids (BidID (pk), date, time, amount, status, ItemID (fk), BuyerID (fk))
Items (ItemID (pk), description, categoryID (fk))
Category (CategoryID(pk))
SubCategory (SubcategoryID (pk), CategoryID (fk))
StorFront (businessno (pk), address)
Feedbacks (FeedbackID (pk), BuyerID (fk), ItemID (fk), rating, comment)
4.3) There is a problem with the Feedback table as there are no candidate key in the relation.
Hence a primary key FeedbackID and two foreign keys BuyerID and ItemID has been
developed in the relation to resolve the issue.
DATABASE CONCEPTS
username,itemID -> rating, Comment
4.2)
Users (UserName (pk), Password, Address)
Buyer (BuyerID (pk), username (fk))
Seller (SellerID(pk), businessno (fk), username (fk), Sate, Country)
Bids (BidID (pk), date, time, amount, status, ItemID (fk), BuyerID (fk))
Items (ItemID (pk), description, categoryID (fk))
Category (CategoryID(pk))
SubCategory (SubcategoryID (pk), CategoryID (fk))
StorFront (businessno (pk), address)
Feedbacks (FeedbackID (pk), BuyerID (fk), ItemID (fk), rating, comment)
4.3) There is a problem with the Feedback table as there are no candidate key in the relation.
Hence a primary key FeedbackID and two foreign keys BuyerID and ItemID has been
developed in the relation to resolve the issue.
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
7
DATABASE CONCEPTS
Bibliography
Elmasri, R. and Navathe, S., 2016. Fundamentals of database systems. London: Pearson.
Coronel, C. and Morris, S., 2016. Database systems: design, implementation, & management.
Cengage Learning.
DATABASE CONCEPTS
Bibliography
Elmasri, R. and Navathe, S., 2016. Fundamentals of database systems. London: Pearson.
Coronel, C. and Morris, S., 2016. Database systems: design, implementation, & management.
Cengage Learning.
1 out of 8
Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
© 2024 | Zucol Services PVT LTD | All rights reserved.