Download presentation
Presentation is loading. Please wait.
1
Review DBS201
2
SALESREP CUSTOMER With referential integrity, which table can not allow a row to be deleted Get rid of the top row of that table The default is for the delete statement to fail
3
SALESREP CUSTOMER What is the clause that supports this above result? On Delete Cascade On what statement is this clause applied? Create Table … Constraint or Alter Table Add Constraint for a foreign key
4
CustRep What is the clause that supports this result when SalesRep 03 is deleted? On Delete Set Default What additional statement is required? INSERT INTO REVW19/SALESREP VALUES(' ', 'Pangborn', 'Russell', '12 Seneca St.', 'Toronto', 'On', '2345', 100, 1.22);
5
If the statements to produce the third scenario were entered into a member called SQLTEST in a source physical file called CLASSREV, what command would provide the screen above allowing execution of the SQL? RUNSQLSTM What entries would you make on the screen above?
6
Determining optionality and cardinality
Each instance of Table B is related to a maximum of one and a minimum of one instance of Table A TABLE A TABLE B
7
Each instance of Table A is related to zero, one or more instances of Table B
TABLE B
9
Different notations are used to represent the cardinality of relationships
1:1 1:M M:N Which one was shown with more detail in the previous examples?
10
ERD
11
ERD Associative Entity
12
Bridge Tables A Company is owned by several Owners who own stock. But Owners can have stock in many companies. Thus COMPANY and OWNER are related as Many to Many.
13
Bridge Tables Let’s say that Joe Small owns $5000 of NORTEL and $3000 of ROGERS. Bill owns $10000 NORTEL and $7000 of Gillette and $5000 of Big “O” Mary has $50000 of NORTEL. The Ownership table (bridge table) has an entry for each. Relations required for the M:N relationship between COMPANIES and OWNERs I COMPANY(Co#, CoName) II OWNERSHIP( Co#, OwnerId , DollarAmount) This bridge table has III OWNER( OwnerID, OwnerName ) more than just the PK!!!
14
LAB’s based on PREMIERE
Labs 8 and 9 Normalization exercises were based on the PREMIERE collection tables ORDERS ORDERLINE PART ORDERLINE was a bridge entity between ORDERS and PART
18
Bridge Tables The Orderline table (bridge table) has unique entries with a concatenated key that match up with one and only one order in the ORDERS table or one and only one part in the PART table What is missing in the Orderline table? Relations required for the M:N relationship between ORDERS and PART I ORDERS(Order#, OrderDate, Cust#) II ORDERLINE( Order#, Part#, QtyOr, QuotedPrice) III PART( Part#, PartDesc, OnHand, Class, Warehouse, ListPrice)
19
What is Normalization? Normalization is a series of steps used to evaluate and modify table structures to ensure that every non-key column in every table is directly dependent on the primary key. The results of normalization are reduced redundancies, fewer anomalies and improved efficiencies.
20
First Normal Form (1NF) 1 2 3
21
Second Normal Form (2NF)
1 2
22
Third Normal Form (3NF) 1 2
23
Normalization Abstract Example
For the following un-normalized relation: RELN1[A, B, {C, D}, E, F, G] where E can be determined by knowing only A, G can be determined by knowing only F and C can be used to determine D 1NF: (without splitting the table) RELN1[A, B, C, D, E, F, G] 2NF: RELN1[A, B, F, G] RELN3[A, E] RELN2[A, B, C, D] 3NF: RELN1[A, B, F] RELN4[F, G]
24
Nested Repeating Groups Example
Representation of a user view in UNF may result in nested repeating groups. The process of resolving a repeating group must be performed starting with the outermost repeating group first to produce a temporary new relation containing a repeating group. The process of resolving a repeating group must then also be performed on this temporary relation
25
STUDIOUS SENIORS ATTENDANCE REPORT
STUDIOUS SENIORS ATTENDANCE REPORT Class# Class Name Room Member# Name Date Attendance 1234 Ballroom Dancing Jane Smith Sept Y Sept Y 1234 Ballroom Dancing Bill Smith Sept Y Sept N 1234 Ballroom Dancing Paul Woo Sept N 1234 Ballroom Dancing Mary Lu Sept Y 2245 Basket Weaving Mary Lu Sept N Sept Y 3122 Italian Cooking Mary Lu Sept Y Sept Y 3122 Italian Cooking Jane Smith Sept Y Sept 22 N UNF? ATTLIST [Class#,ClassName,Room, {Member#, Member_Name, {Date, Attendence} }]
26
UNF ATTLIST [Class#,ClassName,Room, {Member#, Member_Name, {Date, Attendence} }] 1NF ATTLIST(Class#,Member#,Date, ClassName,Room, Member_Name , Attendence) 2NF MEMBER(Member#, Member_Name) CLASS(Class#, ClassName,Room,) ATTLIST(Class#,Member#,Date, Attendence)
27
USERVIEW 1 SENECA SHEAR SALON SERVICE CHARGE LIST
: SERVICE CODE SERVICE DESCRIPTION STATION CODE CHARGE TIME ESTIMATE (min) 10 Cut H 10.00 30 11 Cut and Blow-Dry 15.00 45 12 Perm 30.00 60 13 Highlights 25.00 20 Manicure E 21 Pedicure 23 Hand and Foot Massage M 24 Back Massage 20.00 UNF,1NF,2NF,3NF: Sevrice_Charge_List( ServiceCode, ServiceDesc, StationCode, Charge, Duration)
28
User View 2: SENECA SHEAR SALON INVOICE
DATE: Jul CLIENT: Paul INVOICE#: 1423 HAIR: Cindy, ESTHETICS: MASSAGE: SERVICE CHARGE 10 – Cut SERVICE SUBTOTAL PRODUCT# AND NAME QTY CHARGE 144 Raymond Styling Gel 234 Style Volumizing Shampoo PRODUCT SUBTOTAL: INVOICE SUBTOTAL: PST: GST: INVOICE TOTAL: PREPARED BY: Paula Corelli, #121
29
SENECA SHEAR SALON INVOICE
DATE: Aug 1, CLIENT: Mary INVOICE#: 1425 HAIR: Anna, ESTHETICS: Rachel, MASSAGE: SERVICE CHARGE 12 - Perm 20 - Manicure 21 - Pedicure SERVICE SUBTOTAL PRODUCT# AND NAME QTY CHARGE 234 Style Volumizing Shampoo PRODUCT SUBTOTAL: INVOICE SUBTOTAL: PST: GST: INVOICE TOTAL: PREPARED BY: Amy Smith, #136
30
Userview 2 UNF: INVOICE(Invoice#, ClientName, InvDate, HairEmpNo, HEmpFName, EsthEmpNo, EsthEmpFName, MassEmpNo, MassEmpFName, { ServiceCode, ServiceDesc, Charge}, ServiceSubTotal, { Product#, ProductName, ProductQty, ProductCharge}, ProductSubTotal, PstAmt, GstAmt, PrepEmpNo, PremEmpFName, PrepEmpLName) 1NF: INVOICE(Invoice#, ClientName, InvDate, HairEmpNo, HEmpFName, EsthEmpNo, EsthEmpFName, MassEmpNo, MassEmpFName, ServiceSubTotal, ProductSubTotal, PstAmt, GstAmt, InvoiceTotal, PrepEmpNo, PreepEmpFName, PrepEmpLName) INVOICED_SERVICE(Invoice# FK1, ServiceCode FK2, ServiceDesc, Charge) INVOICED_PRODUCT(Invoice# FK1, Product# FK2, ProductName, ProductQty,ProductCharge)
31
Userview 2 2NF: INVOICE(Invoice#, ClientName, InvDate, HairEmpNo, HEmpFName, EsthEmpNo, EsthEmpFName, MassEmpNo, MassEmpFName, ServiceSubTotal, ProductSubTotal, PstAmt, GstAmt, InvoiceTotal, PrepEmpNo, PreepEmpFName, PrepEmpLName) SERVICE(ServiceCode, ServiceDesc, Charge) INVOICED_SERVICE(Invoice# FK1,ServiceCode FK2) PRODUCT(Product#, ProductName) INVOICED_PRODUCT(Invoice# FK1,Product# FK2, ProductQty,ProductCharge) 3NF INVOICE(Invoice#, ClientName, InvDate, HairEmpNo, EsthEmpNo, , MassEmpNo, ServiceSubTotal, ProductSubTotal, PstAmt, GstAmt, InvoiceTotal, PrepEmpNo) EMPLOYEE(EmpNo, EmpFName, EmpLName) INVOICED_SERVICE(Invoice# FK1, ServiceCode FK2 ) INVOICED_PRODUCT(Invoice# FK1,Product# FK2 , ProductQty, ProductCharge)
32
User View 3 SENECA SHEAR SALON INVENTORY REPORT PRODUCT # PRODUCT NAME SIZE UNIT COST SUPPLIER REORDER POINT REORDER QUANTITY QUANTITY ON HAND 100 Shampoo Towel 3.00 Discount Esthetics 20 30 35 122 Superior Nail Top Coat 10 ml 1.00 5 17 144 Raymond Styling Gel 100 ml 4.00 House of Style Ltd 10 12 145 200 ml 5.00 15 234 Style Volumizing Shampoo 300 ml Salon Products Ltd 235 500 ml 40 250 Raymond Round Brush 6 inch 1.99 2 UNF, 1NF, 2NF, 3NF INVENTORY_REPT (Product#, ProductName, Size, UnitOfMeasure, Ucost, Supplier, ReorderPt, ReorderQty, QtyOnHand)
33
Prog_Yr(ProgYr,PayRate)
User View 4 SENECA SHEAR SALON STUDENT EMPLOYEE REPORT EMP # NAME HOME PHONE CELL PHONE STUDENT# SALONDAY PROG YEAR PAY RATE SEMESTER HOURS 120 Cindy Lee W 3 10.00 22 121 Paula Corelli 2 8.00 20 122 Amy Smith F 123 Paul Huang 21 124 Maria Wong M 19 125 Susan Wong 126 Phil Ramirez T … 144 Paul Smith 145 UNF,1NF,2NF: EMPLOYEE_RPT (Emp#, EmpFName, EmpLName, HPhone,CPhone,Stud#,Day,ProgYr,PayRate, SemHrs) 3NF: Prog_Yr(ProgYr,PayRate) EMPLOYEE_RPT(Emp#, EmpFName, EmpLName, HPhone,CPhone,Stud#,Day,ProgYr,SemHrs)
34
AROMATIX CANADA Inc. , Canada’s leading distributor of perfumes has the following report on sales
UNF – 3NF
35
UNF: 1NF: 2NF AROMATIX CANADA Inc.
Sales[Inv#, SalesPersonName, (ItemDesc, ManufName, NumSold, Price)] 1NF: Sales[Inv#, Item#, SalesPersonId, SalesPersonName, ItemDesc, Manuf#, ManufName, NumSold, Price] 2NF ITEM[Item#, ItemDesc, Manuf#, ManufName,Price] SALES[Inv#(FK1), Item#(FK2), NumSold] INVOICE[[Inv#, SalesPersonId, SalesPersonName]
36
3NF: AROMATIX CANADA Inc. ITEM[Item#, ItemDesc, Manuf#(FK), Price]
MANUFACTURER[Manuf#,ManufName] SALES[Inv#(FK1), Item#(FK2), NumSold] SALESPERSON[SalesPersonId, SalesPersonName] INVOICE[[Inv#, SalesPersonId(FK)]
37
Get a copy of employee data from DBS201SQL
create table employee as (select * from DBS201SQL/employee) with data UPDATE EMPLOYEE SET PAYGRADE = 1 Problems?
38
What command is being run?
39
Too much information!
42
Backward Recovery Command?
43
What is entered here
44
Important Information for Auditor?
User profile who accessed the table Time the action occurred For a delete the ___________ image For an update the ___________ image For an add the ___________ image What else? Open and close – read of a table Output can be sent to three places Screen, Printer, Outfile
45
CRTLIB NEWLIB – add journaling
The three commands in order are: CRTJRNRCV CRTJRN STRJRNLIB
46
Fill in the blanks
47
Fill in the blanks
48
Fill in the blanks
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.