Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Database Management Systems Question 1: Normalization Consider a relation R with six attributes ABCDEF where AB is a composite primary key for R. Assume R

Database Management Systems

Question 1: Normalization

Consider a relation R with six attributes ABCDEF where AB is a composite primary key for R. Assume R has the following functional dependencies (R is one table with the attributes A, B, C, D, E, F):

1.1)

AB => CDEF

B => CDE

D => E

a) In what normal form is relation R? Explain why?

b) Is it possible to decompose R into a number of relations in order to achieve a higher normal form? Explain how (this means using English sentences and a diagram showing the final relation(s)).

1.2)

branchNo

branchAddress

telNo

mgrStaffNo

name

B001

8 Jefferson Way, Portland, OR 97201

503-555-3618

S1500

Tom Daniels

B002

City Center Plaza, Seattle, WA 98122

206-555-6756

S0010

Mary Martinez

B003

14 8th Avenue, New York, NY 10012

212-371-3000

S0145

Art Peters

B004

16 14th Avenue, Seattle, WA 98128

206-555-3131

S2250

Sally Stern

Primary key: branchNo

a) Why the above table is not in 3NF?

b) Describe and illustrate the process of normalizing the data shown in this table to third normal form (3NF).

c) Identify the primary and foreign keys in your 3NF relations.

Question 2: Triggers and Stored Procedures

image text in transcribed

Answer the following questions based on the above database:

1) Create a view named ATL_CHARTERS_V that includes the following For each charter of aircraft to Atlanta (ATL), print the charter date, charter hours wait, and the corresponding customer last name, first name, area code, and phone number. Your answer should include both the SQL statement for view creating along with the contents of the view (you get the contents of the view by select * from ATL-CHARTERS_V).

2) Modify the MODEL table to add the following attribute and insert the values shown in the following table. (Note: use ALTER TABLE and UPDATE commands.)

Attribute name

Attribute Description

Attribute type

Attribute Values

MOD_LIFT_ WEIGHT

Amount of weight each model can lift:

Numeric

10,000 for C-90A

5,000 for PA23-250

20,000 for PA31-350

3) Create a trigger named trg_char_hours that will automatically update the AIRCRAFT table when a new CHARTER row is added. Use the CHARTER tables CHAR_HOURS_FLOWN to update the AIRCRAFT tables AC_TTAF, AC_TTEL, and AC_TTER values. The meaning for the AIRCRAFT table columns are as follows:

AC_TTAF: Total time on the air frame

AC_TTEL: Total time on the left engine (Also used to record single engine hours)

AC_TTER: Total time on the right engine.

So in the trigger, you need to increase all of them with CHAR_HOUR_FLOWN

4) Create a trigger named trg_cust_balance that will automatically update the CUSTOMER tables CUS_BALANCE when a new CHARTER row is added. Use the CHARTER tables CHAR_TOT_CHG as the update source (Assume that all charter charges are charged to the customer balance.) In addition to the CHAR_TOT_CHG, add $5 for every quart of oil used on the charter.

5) Create a stored procedure to update model charge per mile attribute. Procedure takes the model number as a parameter. The procedure increases the charge for this model by 20%.

6) Create a stored procedure that will take an Employee number and percentage, then update the corresponding employees hourly salary by the input percentage (increase the hourly salary, so you are giving the employee a raise). Hint: you may have to do some additional work on this one to get the table correct.

- Database name: Ch08 AviaCo Table name: CHARTER CHAR TRIP CHAR DATE AC NUMBER CHAR DESTINATION CHAR DISTANCE CHAR HOURS FLOWN CHAR GALLONS CHAR OIL_QTS CUS CODE 10011 Table name: EARNEDRATINOG 10001 05-Feb-08 2289L 10002 05-Feb-08 2778V 10003 05-Feb-08 4278 10004 06-Feb-08 1484P 10005 06-Feb-08 2289L 10006 06-Feb-08 4278Y 10007 06-Feb-08 2778V 10008 07-Feb-08 1484P 000907-Feb-08 2289L 10010 07-Feb-08 4278Y 10011 07-Feb-08 1484P 10012 08-Feb-08 2778V 10013 08-Feb-08 4278Y 10014 09-Feb-08 4278 10015 09-Feb-08 2289 10016 09-Feb-08 2778V 10017 10-Feb-08 1484P 10018 10-Feb-08 4278Y 10016 EMP NUM RTG CODE EARNRTG DATE 10014 10019 10011 10017 10012 10014 10017 10016 10012 18-Feb-98 08-Nov-93 1574 21-Apr-93 15-Jul-96 TYS 140.6 459.9 279.7 104 MISTR 1574 18-Nov-97 17-Apr-95 12-Aug TYS 10017 10016 10011 10014 10017 106STR 105.5 10-Mar-94 TYS Table name: CREW Table name: CUSTOMER 96 15-Mar-97 05-Feb-96 12-May CHAR TRIP EMP NUM | CREV.Ce | | cus CODE | CUS LNAME CUS FRAME CUSIN TAL | CUS AREACODE | CUS PHONE | CUS BALANCE 10010 Ramas 10011 Dunne 10012 Smith 10013 Olowski 10014 Orlando 10015 O'Brian 10016 Brown 10017 iliams 10018 Farriss 10019 Smith 844-2573 894-1238 894-2285 894-2180 1285.19 Table name: RATING 1014.56 CFI Certified Flight Flight Instructor, Instrument 290-2556 382-7185 297-3809 NSTR SEL 10010 10011 Table name: EMPLOYEE EMP NLM EMP TITLE | EMP-LNAME | EMPFNAME EMP NTIAL | EMP D08 | EMP HIRE-DATE Single Engine, Land Single Engine, Sea 10012 10013 10014 10015 10015 100 Mr 15-Jun-1942 19-Mar-196525-Apr-1988 Table name: MODEL 14-Nov-1958 16-Oct-1974 08-Nov-1971 15-Mar-1987 102 Mr 20-Dec-1992 28-Aug-2005 20-Oct-1996 PA23-250 Piper 08-Jan-200 PA31-350 Piper 05-Jan-1991 02--1996 18-Nov-1994 MODCODE MODMANUFACTURER MOD MOD- EATS! MOD-CHG - - 267 105 Mr 106 Mrs 107 Mr Navajo Chieftain 10016 10017 10018 10018 12-Feb-1968 21-Aug-1974 14-Feb-1966 18-Jun-1961 19-May-197001-Dec-1992 Jorge Travis Elizabeth Table name: AIRCRAFT Table name: PILOT AC NUMBER | MOD-CODE | AC-TTAF | AC-TTEL AC-TTER | | EMPNUM PIL PIL_MED TYPE PL _MED_DATE PA23-250 101.8 ATPISELMELAnstriCFI ATPISELMELAnstr 42438 PA31-350 PA31-350 1513.1 622.1 02- Jan-08 02-Feb-08 21473 ATPISELMELISESAnstrICFI 22-Jan-08

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

3. Explain the forces that influence how people handle conflict

Answered: 1 week ago