A question about the mediatior system in database 5. In a mediator (data integra
ID: 640193 • Letter: A
Question
A question about the mediatior system in database
5. In a mediator (data integration) system, the mediated schema is Customer (ID, name, statecode) State(statecode. statename) There are two data resources: Si: Customer (ID, full name, region) S2: Customer (ID. first name. last ...name, region code) Region (region-code, region-name) Assume name in the mediated schema means full-name in Si. Region in data resources means state in the mediated schema. For example, state- code or region-code of Oregon is OR. Can you do schema mediation (mapping) in Global-as-View or Local-as-View, or both? Write down your solution(s) in SQL views. Write a query List all customer names in Oregon in SQL based on the mediated schema. Can the query be answered with your views?Explanation / Answer
Answer
S1
Customer(ID,full_name,region)
S2
Customer(ID,first_name,last_name, region_code)
Region(region_code,region_name)
GLOBAL SCHEMA
CREATE VIEW GLOB_CUS AS
SELECT ID,first_name,last_name,region_code as state_code,region_name as state_name
FROM S2.Customer, S2.Region
WHERE Customer.region_code = Region.region_code
UNION
SELECT ID,full_name as name,region as state
FROM S1.Customer
QUERY FOR "list all customer names in "Oregon"
SELECT full_name
FROM Customer c,State s
WHERE c.statecode=s.statecode AND s.statename="Oregon"