Presentation is loading. Please wait.

Presentation is loading. Please wait.

Certification for the module on the relational model

Similar presentations


Presentation on theme: "Certification for the module on the relational model"— Presentation transcript:

1 Certification for the module on the relational model

2 Question – part 1 The following relational schema refers to a retail chain, namely a group of retail stores (or outlets) that share a brand and central management, and usually have standardized business methods and practices. Every store has one store manager and several employees, the same employee can be the manager of different stores. Suppliers delivery items to stores in certain dates. Customers receive Store-Receipts that list items sold to the Customer in Stores.

3 Question – part 2 Store (Store-Id, Address, City, Telephone number, Web address, address, Store-Manager-Id)  Effort-of-Store-Manager (Store-Manager-Id, Store-Id, %-of-time) Employee (Employee-Id, SocialSecurityNumber, First Name, Last Name, Telephone number, Store-Id) Supplier (Vat-Id, Name-of-Supplier, Address, Telephone number) Item-of-Delivery (Item-Code, Price, Type-of-Item, Item-Description) Delivery (Store-Id, Item-Code, Date, Number-of-Items, Supplier) Receipt (Receipt-Number, Store-Id, Clerk, Date, Total Price) Receipt-Item (Receipt-Number, Store-Id, Item-Code, Number-of-Items, Total- Price)

4 Question part 3 – Focus on keys
Look at the following form and for each relation schema (e.g. Store) mark the attribute or the set of attributes that form the primary key.

5 First question: solution
# Relation Maximum score 1 Supplier 8 2 Employee 12 3 Item-of-Delivery 4 Store 5 Effort-of-Store-Manager 6 Receipt 24 7 Receipt-Item Delivery 16

6 Questions on Keys (in red the relation object of the question)
Supplier (Vat-Id, , Telephone number, Name-of-Supplier, Address) Employee (Telephone number, Employee-Id, SocialSecurityNumber, First Name, Last Name, Store- Id) Item-of-Delivery (Item-Code, Price, Type-of-Item, Item-Description) Store (Store-Id, Address, City, Telephone number, Web address, address, Store-Manager- Id)  Effort-of-Store-Manager (Store-Manager-Id, Store-Id, %-of-time) Receipt (Receipt-Number, Store-Id, Clerk, Date, Total Price) Receipt-Item (Receipt-Number, Store-Id, Item-Code, Number-of-Items, Total-Price) Delivery (Store-Id, Item-Code, Date, Number-of-Items, Supplier) Choose among the following possible Primary Keys Score Vat-Id, Telephone number 3 Name-of-Supplier Vat-Id 8 Telephone number 6

7 Questions on Keys (in red the Relation object of the question)
Supplier (Vat-Id, , Telephone number, Name-of-Supplier, Address) Employee (Telephone number, Employee-Id, SocialSecurityNumber, First Name, Last Name, Store-Id) Item-of-Delivery (Item-Code, Price, Type-of-Item, Item-Description) Store (Store-Id, Address, City, Telephone number, Web address, address, Store-Manager- Id)  Effort-of-Store-Manager (Store-Manager-Id, Store-Id, %-of-time) Receipt (Receipt-Number, Store-Id, Clerk, Date, Total Price) Receipt-Item (Receipt-Number, Store-Id, Item-Code, Number-of-Items, Total-Price) Delivery (Store-Id, Item-Code, Date, Number-of-Items, Supplier) Choose among the following possible Primary Keys Score Telephone number 3 SocialSecurityNumber3 10 Employee-Id 12 EmployeeId, SocialSecurityNumber 6 First Name, Last Name

8 Questions on Keys (in red the Relation object of the question)
Supplier (Vat-Id, , Telephone number, Name-of-Supplier, Address) Employee (Telephone number, Employee-Id, SocialSecurityNumber, First Name, Last Name, Store- Id) Item-of-Delivery (Item-Code, Price, Type-of-Item, Item-Description) Store (Store-Id, Address, City, Telephone number, Web address, address, Store-Manager- Id)  Effort-of-Store-Manager (Store-Manager-Id, Store-Id, %-of-time) Receipt (Receipt-Number, Store-Id, Clerk, Date, Total Price) Receipt-Item (Receipt-Number, Store-Id, Item-Code, Number-of-Items, Total-Price) Delivery (Store-Id, Item-Code, Date, Number-of-Items, Supplier) Choose among the following possible Primary Keys Score Type-of-Item Item-Code 8 Item-Code, Type-of-Item 3 Item-Code, Price

9 Questions on Keys (in red the Relation object of the question)
Supplier (Vat-Id, , Telephone number, Name-of-Supplier, Address) Employee (Telephone number, Employee-Id, SocialSecurityNumber, First Name, Last Name, Store- Id) Item-of-Delivery (Item-Code, Price, Type-of-Item, Item-Description) Store (Store-Id, Address, City, Telephone number, Web address, address, Store-Manager- Id)  Effort-of-Store-Manager (Store-Manager-Id, Store-Id, %-of-time) Receipt (Receipt-Number, Store-Id, Clerk, Date, Total Price) Receipt-Item (Receipt-Number, Store-Id, Item-Code, Number-of-Items, Total-Price) Delivery (Store-Id, Item-Code, Date, Number-of-Items, Supplier) Choose among the following possible Primary Keys Score Store-Manager-Id Store-Id 8 Web address 5 address

10 Questions on Keys (in red the Relation object of the question)
Supplier (Vat-Id, , Telephone number, Name-of-Supplier, Address) Employee (Telephone number, Employee-Id, SocialSecurityNumber, First Name, Last Name, Store- Id) Item-of-Delivery (Item-Code, Price, Type-of-Item, Item-Description) Store (Store-Id, Address, City, Telephone number, Web address, address, Store-Manager- Id)  Effort-of-Store-Manager (Store-Manager-Id, Store-Id, %-of-time) Receipt (Receipt-Number, Store-Id, Clerk, Date, Total Price) Receipt-Item (Receipt-Number, Store-Id, Item-Code, Number-of-Items, Total-Price) Delivery (Store-Id, Item-Code, Date, Number-of-Items, Supplier) Choose among the following possible Primary Keys Score Store-Manager-Id 5 Store-Manager-Id, %-of-time 4 Store-Manager-Id, Store-Id 12 Store-Id

11 Questions on Keys (in red the Relation object of the question)
Supplier (Vat-Id, , Telephone number, Name-of-Supplier, Address) Employee (Telephone number, Employee-Id, SocialSecurityNumber, First Name, Last Name, Store- Id) Item-of-Delivery (Item-Code, Price, Type-of-Item, Item-Description) Store (Store-Id, Address, City, Telephone number, Web address, address, Store-Manager- Id)  Effort-of-Store-Manager (Store-Manager-Id, Store-Id, %-of-time) Receipt (Receipt-Number, Store-Id, Clerk, Date, Total Price) Receipt-Item (Receipt-Number, Store-Id, Item-Code, Number-of-Items, Total-Price) Delivery (Store-Id, Item-Code, Date, Number-of-Items, Supplier) Choose among the following possible Primary Keys Score Store-Receipt-Number, Store-Id 12 Store-Receipt-Number 4 Store-Receipt-Number, Clerk 5 Clerk, Date Store-Id, Date

12 Questions on Keys (in red the Relation object of the question)
Supplier (Vat-Id, , Telephone number, Name-of-Supplier, Address) Employee (Telephone number, Employee-Id, SocialSecurityNumber, First Name, Last Name, Store- Id) Item-of-Delivery (Item-Code, Price, Type-of-Item, Item-Description) Store (Store-Id, Address, City, Telephone number, Web address, address, Store-Manager- Id)  Effort-of-Store-Manager (Store-Manager-Id, Store-Id, %-of-time) Receipt (Receipt-Number, Store-Id, Clerk, Date, Total Price) Receipt-Item (Receipt-Number, Store-Id, Item-Code, Number-of-Items, Total-Price) Delivery (Store-Id, Item-Code, Date, Number-of-Items, Supplier) Choose among the following possible Primary Keys Score Store-Receipt-Number Store-Receipt-Number, Store-Id, Number-of-Items 5 Store-Receipt-Number, Store-Id, Item-Code 12 Store-Receipt-Number, Item-Code 9

13 Questions on Keys (in red the Relation object of the question)
Supplier (Vat-Id, , Telephone number, Name-of-Supplier, Address) Employee (Telephone number, Employee-Id, SocialSecurityNumber, First Name, Last Name, Store- Id) Item-of-Delivery (Item-Code, Price, Type-of-Item, Item-Description) Store (Store-Id, Address, City, Telephone number, Web address, address, Store-Manager- Id)  Effort-of-Store-Manager (Store-Manager-Id, Store-Id, %-of-time) Receipt (Receipt-Number, Store-Id, Clerk, Date, Total Price) Receipt-Item (Receipt-Number, Store-Id, Item-Code, Number-of-Items, Total-Price) Delivery (Store-Id, Item-Code, Date, Number-of-Items, Supplier) Choose among the following possible Primary Keys Score Store-Id, Number-of-Items Item-Code, Date 10 Store-Id, Item-Code, Date 14 Store-Id, Item-Code, Date, Supplier 24 Item-Code, Date, Supplier

14 Second question – Referential Integrity Constraints
First of all, look carefully at the following correct solution to the previous question Store (Store-Id, Address, City, Telephone number, Web address, address, Store-Manager-Id)  Effort-of-Store-Manager (Store-Manager-Id, Store-Id, %-of-time) Employee (Employee-Id, SocialSecurityNumber, First Name, Last Name, Telephone number, Store-Id) Supplier (Vat-Id, Name-of-Supplier, Address, Telephone number) Item-of-Delivery (Item-Code, Price, Type-of-Item, Item-Description) Delivery (Store-Id, Item-Code, Date, Number-of-Items, Supplier) Receipt (Receipt-Number, Store-Id, Clerk, Date, Total Price) Receipt-Item (Receipt-Number, Store-Id, Item-Code, Number-of-Items, Total- Price)

15 Second question Identify Referential integrity constraints defined among pairs of relations, and their number of occurrences (if you do not fill the cell, this means 0) Store (Store-Id, Address, City, Telephone number, Web address, address, Store-Manager-Id)  Effort-of-Store-Manager (Store-Manager-Id, Store-Id, %-of-time) Employee (Employee-Id, SocialSecurityNumber, First Name, Last Name, Telephone number, Store-Id) Supplier (Vat-Id, Name-of-Supplier, Address, Telephone number) Item-of-Delivery (Item-Code, Price, Type-of-Item, Item-Description) Delivery (Store-Id, Item-Code, Date, Number-of-Items, Supplier) Store-Receipt (Store-Receipt-Number, Store-Id, Clerk, Date, Total Price) Store-Receipt-Item (Store-Receipt-Number, Store-Id, Item-Code, Number-of-Items, Total-Price) #Z Store Effort-of-Store-Manager Store-Employee Supplier Item Delivery Receipt Receipt-Item 1 2 3 Employee 4 5 6 7 8 From To 

16 Solution to the second question
Store (Store-Id, Address, City, Telephone number, Web address, address, Store-Manager-Id)  Effort-of-Store-Manager (Store-Manager-Id, Store-Id, %-of-time) Employee (Employee-Id, SocialSecurityNumber, First Name, Last Name, Telephone number, Store-Id) Supplier (Vat-Id, Name-of-Supplier, Address, Telephone number) Item-of-Delivery (Item-Code, Price, Type-of-Item, Item-Description) Delivery (Store-Id, Item-Code, Date, Number-of-Items, Supplier) Receipt (Receipt-Number, Store-Id, Clerk, Date, Total Price) Receipt-Item (Receipt-Number, Store-Id, Item-Code, Number-of-Items, Total-Price) #Z Store Effort-of-Store-Manager Store-Employee Supplier It0em Delivery Receipt Receipt-Item 1 2 3 Employee 4 5 Item 6 7 8 From To 

17 Scores assigned to correct Integrity constraints
Store (Store-Id, Address, City, Telephone number, Web address, address, Store-Manager-Id)  Effort-of-Store-Manager (Store-Manager-Id, Store-Id, %-of-time) Employee (Employee-Id, SocialSecurityNumber, First Name, Last Name, Telephone number, Store-Id) Supplier (Vat-Id, Name-of-Supplier, Address, Telephone number) Item-of-Delivery (Item-Code, Price, Type-of-Item, Item-Description) Delivery (Store-Id, Item-Code, Date, Number-of-Items, Supplier) Receipt (Receipt-Number, Store-Id, Clerk, Date, Total Price) Receipt-Item (Receipt-Number, Store-Id, Item-Code, Number-of-Items, Total-Price) #  1 2 3 4 5 6 7 8 # Store Effort-of-Store-Manager Store-Employee Supplier Item Delivery Receipt Receipt-Item 9 Employee 15 25 From To 

18 Procedure for the total score
If Solution(1,3) = StudentSolution(1,3) then Total-score = Total-score + 9 If Solution(3,1) = StudentSolution(3,1) then Total-score = Total-score + 15 If Solution(6,1) = StudentSolution(6,1) then Total-score = Total-score + 9 If Solution(6,4) = StudentSolution(6,4) then Total-score = Total-score + 15 If Solution(6,5) = StudentSolution(6,5) then Total-score = Total-score + 9 If Solution(7,1) = StudentSolution(7,1) then Total-score = Total-score + 9 If Solution(7,4) = StudentSolution(7,4) then Total-score = Total-score + 9 If Solution(8,7) = StudentSolution(8,7) then Total-score = Total-score + 25

19 Simplified procedure for the total score 27/03/2018
If StudentSolution(1,3) = 1 then Total-score = Total-score + 9 If StudentSolution(3,1) = 1 then Total-score = Total-score + 15 If StudentSolution(6,1) = 1 then Total-score = Total-score + 9 If StudentSolution(6,4) = 1 then Total-score = Total-score + 15 If StudentSolution(6,5) = 1 then Total-score = Total-score + 9 If StudentSolution(7,1) = 1 then Total-score = Total-score + 9 If StudentSolution(7,4) = 1 then Total-score = Total-score + 9 If StudentSolution(8,7) = 1 then Total-score = Total-score + 25

20 Left over

21 Referential integrity constraints – correct solution
Store (Store-Id, Address, City, Telephone number, Web address, address, Store-Manager-Id)  Effort-of-Store-Manager (Store-Manager-Id, Store-Id, %-of-time) Store-Employee (Employee-Id, SocialSecurityNumber, First Name, Last Name, Telephone number, Store-Id) Supplier (Vat-Id, Name-of-Supplier, Address, Telephone number) Item (Item-Code, Price, Type-of-Item, Item-Description) Delivery (Store-Id, Item-Code, Date, Number-of-Items, Supplier) Store-Receipt (Store-Receipt-Number, Store-Id, Employee, Date, Total Price) Store-Receipt-Item (Store-Receipt-Number, Store-Id, Item-Code, Number-of- Items, Total-Price)


Download ppt "Certification for the module on the relational model"

Similar presentations


Ads by Google