Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

ERD: UPS System

SHIPPED_ITEM

RETAIL_CENTER
item_num PK
weight
dimensions
insurance_amt
destination
delivery_date
sched_num FK

TRANSPO_EVENT

sched_num PK
type_of_transp
o
delivery_route

retail_id PK
address
item_num FK

TEST II. Stored Procedure


1. Create an insert stored procedure in each entity that you have made.
Create PROCEDURE shipped_item
(
p_item_number int,
p_weight float,
p_insurance_amount varchar(20)
p_dimension varchar(30),
p_destination varchar(30),
p_delivery_date int)
sql security invoker
BEGIN
Insert into shipped_item
(item_number,weight,insurance_amount,dimension,destination,delivery_date);
Values(p_item_number, p_weight , p_insurance_amount
,p_dimension,p_destination,p_delivery_date);
END
create PROCEDURE retail_center(
p_retail_id int,
p_type varchar(20),
p_address varchar(30))
sql security invoker
BEGIN
Insert into retail_center (retail_idt,type,address);
Values(p_retail_id,p_type,p_address);
END
create PROCEDURE transportation_event (
p_schedule_number int,
p_type_of_transportation varchar(20)
p_delivery_route varchar(50))
sql security invoker
BEGIN
Insert into transportation_event (schedule_number, type_of_transportation
,delivery_route);
Values(p_schedule_number ,p_ type_of_transportation ,p_delivery_route);
END

2. Create a query that will locate the current location of the item.
Select

AS
FROM

shipped_item.item_number,
shipped_item.weight,
shipped_item.dimensions,
shipped_item.insurance_amount,
shipped_item.destination,
shipped_item.delivery_date,
retail_center.type,
retail_center.address
location

shipped_item
INNER JOIN
retail_center
ON
shipped_item.item_number= retail_center.item_number;
3. Create a query that will identify the route of an item
Select
shipped_item.item_number,
shipped_item.weight,
shipped_item.destination,
transportation_event. type_of_transportation,
transportation_event.delivery_route
AS
Route_of _an_item
FROM
shipped_item
INNER JOIN
transportation_event
ON
shipped_item.schedule_number=transportation.schedule_number

You might also like