Você está na página 1de 6

CSB2014 DATABASES Assignment 2

___________________________________________________________________________________

Semester: January 2008


CSB2014 DATABASES Assignment 2
Due Deliverables Mode of assignment ercentage Submission Detail Sunday, 6 April 2008 Hardcopy report Individual !" # $!00 Mar%s& Hand in a printed $paper& copy 'or students in ()s, submit to your respective instructors* The cover/title page should contain these information: o Your Project Title/Name o Your Name/ Group Members With Respective Matric Number o ourse ode !nd Name o "ection Number o #nstructor$s Name o %ate &f "ubmission Your assignment must o be submitted before or b' the due date( )atenc' *ill cause 'ou some mar+s deduction( o ,uote all references used- follo* the !P! format http://*ebster(commnet(edu/apa/inde.(htm

+eneral Instructions

/(

0sing the 1!RT2R table$s contents3 *rite the "4) ,uer' that *ill produce the output sho*n in Table /( Note that the output is limited to selected attributes for aircraft number 56678( Table /: "elected !ttributes from the 1!RT2R Table 9or !ircraft 56678

5( <(

reate a virtual table :named ! 56678; containing the output presented in ,uestion /( Produce the output sho*n in Table 5 for aircraft 56678( Note that this output includes data from the 1!RT2R and 0"T&M2R tables( :Hint: 0se a join in this ,uer'(;

FacultyOfIT/Unita

!/"/2014

CSB2014 DATABASES Assignment 2

___________________________________________________________________________________
Table 5: "elected &utput from the 1!RT2R and 0"T&M2R Tables

=(

Produce the output sho*n in Table < for aircraft 56678( Note that this output includes data from the 1!RT2R3 2MP)&Y223 and M&%2) tables( Hint: T*o of the joins pass through other tables( 9or e.ample3 the >connection? bet*een 1!RT2R and M&%2) re,uires the e.istence of !#R R!9T3 because the 1!RT2R table does not contain a foreign +e' to M&%2)( 1o*ever3 1!RT2R does contain a foreign +e' to !#R R!9T3 *hich contains a foreign +e' to M&%2)( Table <: "elected &utput from the 1!RT2R3 2MP)&Y22 and M&%2) Tables

@(

Modif' the ,uer' in ,uestion = to include data from the 0"T&M2R table( This time3 the output is limited b' the date selection3 as sho*n in Table =( 0se the clause W12R2 1!RA%!T2 BC D@//@//EEE$F to define the ,uer'$s date restriction( Table =: "elected &utput from the 1!RT2R3 2MP)&Y223 M&%2) and Tables 0"T&M2R

G(

Modif' the ,uer' in 4uestion @ to produce the output sho*n in Table @( Table @: "elected &utput from the 1!RT2R3 M&%2) and 0"T&M2R Tables

6(

Modif' the ,uer' in ,uestion G to produce the computed :derived; attributes >fuel per hour? and >total mileage charge(? :1int: #t is possible to use "4) to produce computed >attributes? that are not stored in an' table( 9or e.ample3 the follo*ing "4) ,uer' is perfectl' acceptable(; "2)2 T 1!RA%#"T!N 23 1!RAG!))&N"3 1!RA%#"T!N 2/ 1!RAG!))&N"

FacultyOfIT/Unita

!/"/2014

CSB2014 DATABASES Assignment 2

___________________________________________________________________________________
1!RT2R W12R2 1!RA%!T2 BC D/@HM!YH/EEE$F 0se a similar techni,ue on joined tables to produce the output sho*n in Table G( Table G: 0sing a "4) 4uer' to Produce omputed :%erived; !ttribute 8alues 9R&M

7(

Modif' the ,uer' 'ou produced in problem 6 to create the output sho*n in Table 6( Note that3 in this case3 the computed attributes are derived from t*o different tables( :1int: The M&%2) table contains the charge per mile and the 1!RT2R table contains the total miles flo*n( Note also that the output is ordered b' date and3 *ithin the date3 b' the customer$s last name(; Table 6: 0sing a "4) 4uer' to Produce Mileage harges

E(

0se the techni,ues that produced the output in problem 7 to produce the charges sho*n in %atabase Table 7( The total charge to the customer is computed b': Miles flo*n I charge per mile 1ours *aited I J@K per hour The miles flo*n : 1!RA%#"T!N 2; is found in the 1!RT2R table3 the charge per mile :M&%AM#)2 1!RG2; is found in the M&%2) table3 and the hours *aited : 1!RAW!#T; are found in the 1!RT2R table( Table 7: 0sing a "4) 4uer' to Produce Total ustomer harges

/K(

reate the "4) ,uer' that *ill produce a list of customers *ho have an unpaid balance( The re,uired output is sho*n in Table E( Note that the balances are listed in descending order( Table E: ! )ist of ustomers *ith 0npaid Lalances

FacultyOfIT/Unita

!/"/2014

CSB2014 DATABASES Assignment 2

___________________________________________________________________________________

//( 9ind the average unpaid customer balance3 the minimum balance3 the ma.imum balance3 and the total of the unpaid balances( The resulting values are sho*n in Table /K( Table /K: The !verage 0npaid ustomer Lalances

/5( 0sing the 1!RT2R table as the source3 group the aircraft data3 then use the "4) functions to produce the output sho*n in Table //( Table //: The !ircraft %ata "ummar' "tatement

/<( Write the "4) code to generate the output sho*n in Table /5( Note that the listing includes selected 1!RT2R attributes for all flights that did not include a coHpilot( :1int: Tr' using the #" N0)) functionM !nd remember that the pilot$s last name re,uires access to the 2MP)&Y22 table3 *hile the aircraft model re,uires access to the M&%2) table(; Table /5: ! )isting of !ll harter 9lights that %id not 0se a oHPilot

/=( Write the "4) code that *ill update the !#R R!9T table$s airframe and engine hours b' adding to them the total hours flo*n b' each aircraft in the 1!RT2R table( :1int: #n order to preserve the original !#R R!9T table$s values3 use R&))L! N after 'ou have finished this problem(; /@( Generate a listing of all purchases made b' the customers3 using the output sho*n in Table /< as 'our guide( :1int: Group b' 0"A &%2 in the #N8&# 2 table(;

FacultyOfIT/Unita

!/"/2014

CSB2014 DATABASES Assignment 2

___________________________________________________________________________________
Table /<: ! )isting of ustomer Purchases

/G( 0sing the output sho*n in Table /= as 'our guide3 generate the listing of customer purchases3 including the subtotals for each of the invoice line numbers( :1int: Modif' the ,uer' format used to produce the listing of customer purchases in problem /73 delete the customer name3 then add the derived :computed; attribute )#N2A0N#T" I )#N2APR# 2 to calculate the subtotals(; Table /=: ! "ummar' of ustomer Purchases *ith "ubtotals

FacultyOfIT/Unita

!/"/2014

CSB2014 DATABASES Assignment 2

___________________________________________________________________________________
/6( No* modif' the ,uer' used in problem /E to produce the summar' sho*n in Table /@( Table /@: ! ustomer Purchase "ummar'

/7( Modif' the ,uer' in problem 5K to include the number of individual product purchases made b' each customer( :#n other *ords3 if the customer$s invoice is based on three products3 one per )#N2AN0ML2R3 'ou are counting three product purchases( #f 'ou e.amine the original invoice data3 'ou *ill note that customer /KK// generated three invoices *hich contained a total of si. lines3 each representing a product purchase(; Your output values must match those sho*n in Table /G: Table /G: ! "ummar' of Made ustomer Purchases3 #ncluding the Number of Purchases

FacultyOfIT/Unita

!/"/2014