Question

In: Computer Science

Part A The table below lists customer/car hires data. Each customer may hire cars from various...

Part A

The table below lists customer/car hires data. Each customer may hire cars from various outlets throughout Singapore. A car is registered at a particular outlet and can be hired out to a customer on a given date.

carReg

make

model

custNo

custName

hireDate

outletNo

outletLoc

M565 0GD

Ford

Escort

C100

Smith, J

14/5/18

01

Queenstown

M565 0GD

Ford

Escort

C201

Hen, P

15/5/18

01

Queenstown

N734 TPR

Nissan

Sunny

C100

Smith, J

16/5/18

01

Queenstown

M134 BRP

Ford

Escort

C313

Blatt, O

14/5/18

02

Tampines

M134 BRP

Ford

Escort

C100

Smith, J

20/5/18

02

Tampines

M611 0PQ

Nissan

Sunny

C295

Pen, T

20/5/18

02

Tampines

Instructions:

  1. The data in the table is susceptible to update anomalies. Provide examples of how insertion, deletion, and modification anomalies could occur on this table.
  2. Describe and illustrate the process of normalization by converting Table 1 to Third Normal Form (3NF) relations. Identify the primary and foreign keys in your 3NF relations.

Part B

The following tables form part of a database held in a Relational Database Management System for a printing company that handles printing jobs for book publishers:

Publisher                        (pubID, pubName, street, city, postcode, telNo, creditCode)

              BookJob                          (jobID, pubID, jobDate, description, jobType)

              PurchaseOrder               (jobID, poID, poDate)

              POItem                            (jobID, poID, itemID, quantity)

              Item                                  (itemID, description, onHand, price)

Where:

Publisher                          contains publisher details and pubID is the key.

BookJob                            contains details of the printing jobs (books or part books) and jobID is the key.

PurchaseOrder                 A printing job requires the use of materials, such as paper and ink, which are assigned to a job via purchase orders. This table contains details of the purchase orders for each job and the key is jobID/poID. Each printing job may have several purchase orders assigned to it.

POItem                              Each purchase order (PO) may contain several PO items. This table contains details of the PO items and jobID/poID/itemID form the key.

Item                                   contains details of the materials which appear in POItem, and the key is itemID.

Instructions:

Formulate the following queries using SQL:

(i)                         List all publishers in alphabetical order of name.

(ii)                        List all printing jobs for the publisher ‘Gold Press’.

(iii)                      List the names and phone numbers of all publisher who have a rush job (jobType = ‘R’).

(iv)                       List the dates of all the purchase orders for the publisher ‘PressMan’.

(v)                        How many publisher fall into each credit code category?

(vi)                       List all job type’s with at least three printing jobs.

(vii)                     List the average price of all items.

(viii) List all items with a price below the average price of an item.

Solutions

Expert Solution

Part A

i)Anomalies

insertion anomaly ---- If a new outlet is opened and there is no customer hires and does car registration, carReg is null which violates entity integrity constraint as carReg is primary key.

updation ---- If an outlet location is changed it should be updated in all concerned rows (redundant data) . If not done on all rows, inconsistency exists in the database.

deletion ------ If the customer C201 is deleted from the database, all the associated data carReg, make, model will also get deleted.

ii)Normalization

1NF(All attributes should be atomic)

CustomerCarHire(carReg, make, model, custNo, custName, hireDate, outletNo, outletLoc)

Composite Primary key --- carReg, custNo

2NF(remove partial dependencies)

Partial Functional dependencies

carReg -> make, model, hireDate, custNo, outletNo, outletLoc

custNo -> custName

tables in 2NF

CarRegistration(carReg , make, model, hireDate, custNo, outletNo, outletLoc)

Customer(custNo , custName)

3NF(remove transitive dependencies)

transitive dependency:

outletNo -> outletLoc

Tables in 3NF

CarRegistration(carReg , make, model, hireDate, custNo, outletNo)

Customer(custNo , custName)

Outlet(outletNo , outletLoc)

bold attributes are primary keys and italicized are foreign keys.

Part B

(i)

Select * from Publisher order by pubName;

(ii)   

Select BookJob.* from BookJob ,Publisher where BookJob.pubID = Publisher.pubID and pubName = 'Gold Press';

(iii)   

Select pubName, telNo from BookJob ,Publisher where BookJob.pubID = Publisher.pubID and jobType = 'R';

(iv)   

Select poDate from PurchaseOrder ,BookJob, Publisher where pubName ='PressMan';

(v)

Select Count(pubId) from Publisher group by creditCode ;

(vi)   

Select jobType from BookJob group by jobType having description LIKE '%Printing%' and Count(jobId) >= 3;

(vii)   

Select Avg(Price) from Item;

(viii)

Select * from Item where price <(Select Avg(Price) from Item);

Do ask if any doubt. Please up-vote.


Related Solutions

The table below lists maintenance cost vs. the age of cars for a sample of seven...
The table below lists maintenance cost vs. the age of cars for a sample of seven cars. The goal was determine if there was a correlation between the age of a car and the cost to maintain it. The least squares regression equation describing the maintenance costs (Y′) vs. the age of the car (X) was determined to be Y' = −4.75 + 2.8929X Age of Car (yrs) Maintenance Costs ($hundreds) 2 3 3 5 4 6 5 7 6...
The data in the table represent the weights of various domestic cars and their miles per...
The data in the table represent the weights of various domestic cars and their miles per gallon in the city for the 2008 model year. For the data from the first 11​ cars, the​ least-squares regression line is y=−0.0062x+42.4755. A twelfth car weighs 2,705 pounds and gets 14 miles per gallon. Compute the coefficient of determination of the expanded data set​ (including the twelfth​ car). What effect does the addition of the twelfth car to the data set have on...
The data in the table represent the weights of various domestic cars and their miles per...
The data in the table represent the weights of various domestic cars and their miles per gallon in the city for the 2008 model year. For these​ data, the​ least-squares regression line is ModifyingAbove y with -0.006x + 42.216. A twelfth car weighs 3,425 pounds and gets 12 miles per gallon. ​(a) Compute the coefficient of determination of the expanded data set. What effect does the addition of the twelfth car to the data set have on Rsquared​? ​ (b)...
The table below lists the numbers of words spoken in a day by each member of...
The table below lists the numbers of words spoken in a day by each member of randomly selected couples. Complete parts below. Use a 0.05 significant level to test the claim that among couples, males speak fewer words in a day than females. Female 27000 16870 28783 25177 21677 17178 26813 23831 Male 22665 23117 17592 12991 11902 20167 14957 20671 First, you need to check the requirements. 1) it is a __________ _________ Sample; 2) either the number of...
The table below lists the numbers of words spoken in a day by each member of...
The table below lists the numbers of words spoken in a day by each member of randomly selected couples. Complete parts below. Use a 0.05 significant level to test the claim that among couples, males speak fewer words in a day than females. Female 27000 16870 28783 25177 21677 17178 26813 23831 Male 22665 23117 17592 12991 11902 20167 14957 20671 f. What is your conclusion ______________________________ and it means in this context:
5. The table below lists situation in numbers by WHO regions as of May 27, 2020:...
5. The table below lists situation in numbers by WHO regions as of May 27, 2020: Country, Other Cases Deaths TOTAL CASES Africa 85,815 2,308 Americas 2,495,924                      2,641,734.00 Eastern Mediterranean 11,452                          461,042.00 Europe 2,061,828                      2,238,054.00 South-East Asia 6,359                          224,882.00 Western Pacific 176,404 6,927 TOTALS 27,046                      5,837,166.00 a. Complete the totals. b. What is the probability that a randomly selected person in the Americas? c. What is the probability that a randomly selected person in Europe?...
Below is a data table from a survey of 12 random car owners that were asked...
Below is a data table from a survey of 12 random car owners that were asked about their typical monthly expenses in dollars on gasoline. 210 160 43 255 176 135 221 359 380 405 391 477 (a) Is there evidence at the 5% significance level to suggest the mean monthly gasoline expense for all car owners is less than $200? (b) Interpret the P-value in the context of this test. (c) Explain what a Type I error would mean...
The data below lists the population of the United States each year from 2000 until 2010....
The data below lists the population of the United States each year from 2000 until 2010. (Hint: see Chapter 7 Project Part 1) a. (4 points) Use EXCEL to make a scatter plot and find a linear model of your data. Let the horizontal axis represent the years after 2000 (the year 2000 would be 0) and let the vertical axis represent the US population in millions. Provide a title for your graph, label both the vertical and horizontal axes,...
The table below show data that has been collected from different fields from various farms in...
The table below show data that has been collected from different fields from various farms in a certain valley. The table contains the grams of Raspberries tested and the amount of their Vitamin C content in mg. Find a linear model that express Vitamin C content as a function of the weight of the Raspberries. grams Vitamin C content in mg 75 21.2 80 23.2 85 25 90 27.8 95 30 100 32.3 105 33.6 A) Find the regression equation:...
1. The table below show data that has been collected from different fields from various farms...
1. The table below show data that has been collected from different fields from various farms in a certain valley. The table contains the grams of Raspberries tested and the amount of their Vitamin C content in mg. Find a linear model that express Vitamin C content as a function of the weight of the Raspberries. Round your answers to 3 decimal places Raspberry Type grams Vitamin C content in mg Farm A - North Field 65 16.4 Farm B...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT