Er model to relational schema mapping

Assignment Help Database Management System
Reference no: EM13742081

Question 1. Relational model.

For the relation

R (A, B, C, D, E, F, G)

The following functional dependencies hold

G → D, F, C, E
E → A
D → F
A, B → C
E → B

a) Use inference rules to find the minimal basis for the given FDs.

b) From the minimal basis, determine the key(s) of the relation.

c) Based on the key(s), determine if the relation is in BCNF. Explain your answer in terms of the FDs and the key(s).

Given the following relation for real estate sales.

REALESTATE (PropertyID, Address, AgentName, Price, Commission, AgentPhone, CustomerName, CustomerPhone, SalesTax)

and the following functional dependencies;

PropertyID -> Address, Price
AgentName -> AgentPhone
Price -> SalesTax
CustomerName -> CustomerPhone
AgentName, Price -> Commission

d) Find the Primary Key of the REALESTATE relation.

e) Prove the REALESTATE relation is not in BCNF or 3NF.

f) Decompose the REALESTATE relation into BCNF/3NF relations. Show the final schema in full with all primary keys and foreign keys marked appropriately.

Question 2. ER model

Consider the following description for building a sales database for the Smartwear garment store. Design an ER diagram for the database.

• Smartwear employs salespeople. Information about a salesperson includes a unique employee ID, and his/her name and position.

• Each customer of Smartwear is identified by a customer ID, and is also described by the customer name.

• Suppliers of Smartwear are described by a unique name, and a contact phone number.

• Garments stocked by Smartwear are described by a product code, size, colour and a set retail price.

• A garment must have at least one supplier and a supplier can supply more than one garment. A wholesale price is specified when a supplier supplies a garment.

• Customers order garments. Details of an order include date of the order and quantity of the garment s/he orders.

• Each salesperson of Smartwear looks after a list of customers, where s/he provides VIP service. A VIP customer is associated with one salesperson.

According to the given description, construct an Entity Relationship (ER) diagram for the database, and make assumptions where necessary. You must represent entities, relationships and their attributes, and all applicable constraints in your ER diagram.

Explain any concepts in the description that can not be expressed in the ER diagram.

Your ER diagram must use notations in the lecture notes and should not be hand drawn.

ER diagrams using other notations will receive zero mark for this question. You should use the ER diagramming tool Dia, which can be downloaded from the course Blackboard (Course Content → ER Diagram Tools).

Question 3. ER model to relational schema mapping.

Below is the ER diagram for the management database of a service company. The company has several departments and employees book company cars to visit clients. Map the ER diagram into a relational database schema. Give the schema for each relation after mapping and mark up primary keys and foreign keys.

Note: Supporting relationships for weak entity sets can have attributes.

955_Compute the closure for Property.png

Question 4. SQL.

Schema for the Academics database is as follows:

DEPARTMENT(deptnum, descrip, instname, deptname, state, postcode)

ACADEMIC(acnum, deptnum*, famname, givename, initials, title)

PAPER(panum, title)

AUTHOR(panum*, acnum*)

FIELD(fieldnum, id, title)

INTEREST(fieldnum*, acnum*, descrip)

Some notes on the Academic database:

• An academic department belongs to one institution (instname) and often has many academics. An academic only works for one department.

• Research papers (PAPER) are often authored by several academics, and of course an academic often write several papers (AUTHOR).

• A research field (FIELD) often attracts many academics and an academic can have interests in several research fields (INTEREST).

Primary keys are underlined and foreign keys are marked with *. The SQL script for defining and populating the database academics.sql can be downloaded from the course blackboard (Course content → Databases).

Write one SQL queries for each question below; otherwise you will receive zero mark for the question. Each component of an SQL statement must be on a separate line. For example, the two queries below:

(a)

SELECT deptnum
FROM Department
WHERE postcode between 3000 and 3999;

(b)
SELECT distinct deptnum
FROM Department D1, ACADEMIC A1
WHERE D1.deptum=A1.deptnum and
postcode between 3000 and 3999;

Do not include the result of the query or the script used to create the tables. Your query should not produce duplicates in output but use DISTINCT only if necessary.

Note: your query will be marked on correctness as well as efficiency. For example, Query (b) above is not as efficient as Query (a) though they are both correct for "List deptnum of departments with postcode in [3000..3999]".

a) How many institutions contain the term "Technology" in their name. Your query must produce a single number as its output.

b) Make a list of academics that meet the following conditions:

• Have more than five interests and have written or co-written less than ten papers.

• Do not have an interest in either of these two fields;
  o Field number 434 : Pitcure/Image Generation
  o Field number 492 : Design Styles

Use an (NOT) IN construct to test for the first condition.

Use a (NOT) EXISTS construct to test for the second requirement.

Output all details of the academics in the list.
(Hint: When testing for interest in a field, use the field number, not the title.)

c) Use a Set operator to create a list of academics who have written or co-written less than 5 papers and also have greater than 3 interests. List their academic number in the output.

d) Explain the following SQL query in English;

select givename, famname, instname
from academic natural join department
where acnum in
(select acnum
from author
where acnum not in
(select acnum
from interest
))
and deptNum in (select deptNum
from academic
where deptname = ‘Computer Science');
Note: Your explanation should not be literal. Use the description in Questions a), b), c), e) and f) as examples for good explanations.

e) Find all the academics who have co-written a paper with academic number 151.

Use only the Author table in a join query. You can use multiple instances of the table. The output should list the academic number of each co-author just once in the output. The output should not include academic number 151.

f) Write a query to find academics that are authors and that have only ever coauthored papers with authors from institutes in the same state as their own. List their academic number, title and last name.

Question 5.

a) This question is regarding the REALESTATE relation in Question 4.

Consider the FDs given,

• Compute the closure for PropertyID.
• With the relation below

Property(PropertyID, Address, Price, SalesTax)

Is the relation in BCNF or 3NF? Explain your answer using the given FDs.

b) This question is regarding the Academics database. For each academic, what is the total number of System (paper title containing "System" in whatever cases) papers s/he has written. Academics who are authors and who have not written any System papers should have a count of 0. Output the acnum and the corresponding number of papers for each academic. Output should be in descending order of total number of System papers.

Reference no: EM13742081

Questions Cloud

An array of scores measuring specific mental abilities : Around age 6, IQ becomes more stable than it was at earlier ages, and it correlates well with academic achievement. Intelligence tests provide an overall score (the IQ), which represents general intelligence, as well as an array of scores measuring s..
Stakeholder analysis and stakeholder management strategy : The two primary areas that you will thoroughly develop for this assignment are a motivation strategy/campaign and a communications plan based on your stakeholder analysis and stakeholder management strategy you accomplished in Phase 3. A table for..
Let the inverse demand curve for tennis classes : Let the inverse demand curve for tennis classes is: P = 90 - 1.5Q.
Is the demand for this good price elastic or price inelastic : Think of another good that you have purchased recently Be specific (e.g. is it breakfast cereal in general or Cheerios cereal specifically). If the price of this item increases, how would this affect the quantity of the good that you consume? Is the ..
Er model to relational schema mapping : Use inference rules to find the minimal basis for the given FDs - from the minimal basis, determine the key(s) of the relation.
Two elements are found together in business networks : Discuss why these two elements are found together in business networks. Identify and discuss the advantages and disadvantages of the PoE technology. Provide examples to support your discussion. Must be a minimum of 300 words in length.
Explain how socrates and plato uses irony and contradiction : Explain how Socrates and Plato uses irony and contradiction to both refute the charges of youth corruption and believing in new gods and how this refutation concomitantly indicts both the prosecutors and the jury members.
Explain how the law of demand affected your purchase : Think about a product that you have purchased recently (e.g. soda, diapers, takeout meals, milk, shoes, manicure/pedicure, video game, etc.). Explain how the law of demand affected your purchase. Give specific examples of how the determinants of dema..
Essay describing the ritual : Write a 300-word essay describing the ritual you have chosen, making sure to clearly illustrate how it fits the criteria for a Rite of Passage

Reviews

Write a Review

Database Management System Questions & Answers

  Design a flowchart for a program

Design a flowchart for a program that declares an array of 10 characters. Program should count and print number of times a special character, (your choice, let say ‘a') has been found in the array.

  Can you say that attribute b defnitely is or is not a key

State the defnition of a lossless-join decomposition with respect to this example. Answer this question concisely by writing a relational algebra equation involving R, R1, and R2.

  What was the total value of the disputed order

Write SQL SELECT statements to retrieve the following information from the ClassicModels database - select the product name, scale, vendor and product code for all models of classic cars built between 1948 and 1966. Display the results in order of..

  Is it possible for r to be in bcnf if so under what conditon

Consider the relation schema R(A,B,C), which has the FD B → C. If A is a can-didate key for R, is it possible for R to be in BCNF? If so, under what conditions? If not, explain why not.

  Write set of relational schemas-identify primary-foreign key

Sketch an E-R diagram which reflects the above reuirements. Write a set of relational schemas and identify primary and foreign keys. Try not to include redundant schemas.

  Create database db2game

LOAD FROM "C:\db2game\tutors.csv" of del insert into tutors (student_id, given_name, family_name, course_code, hourly_wage, status);

  Create a gantt chart illustrating the project tasks

Write clearly and concisely about Systems Analysis and Development topics using proper writing mechanics and technical style conventions.

  Designing and documenting your system

Create a document named: surnameStudentIDAssign1.doc .  In your document, you must include the following section headings:  System Overview, Class Diagram, Class Descriptions, Testing.

  Product in traditional costing system - bullie manufacturing

Determine the manufacturing overhead cost per unit of each of the company's two products under the traditional costing system.

  List the details of parts supplied by quality

Attribute dob is the customer's date of birth, stops is the number of stops (0-??) a flight requires, and onTime is a percentage (0-100) indicating how often a flight is on time. Keys are underlined.

  Find the resulting tuples of the given query

What time does it take to find the resulting tuples of the given query: "List the names of all students who are taking a class in the Turing Auditorium".

  Explain the datawarehouse and data mining concepts

There are six major types of information systems which organisations use in their operations. Discuss how these information systems support managers in their decision making role Explain the datawarehouse and data mining concepts using appropria..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd