A. Several volunteer opportunities have become available during Spring Break 201
ID: 3869907 • Letter: A
Question
A. Several volunteer opportunities have become available during Spring Break 2018. Create a table named spring_break 2018 with four columns: an auto incrementin the name of the opportunity (e.g. Hurricane Harve (e.g. Houst whole dollars (i.e. no fractions of a dollar). Establish the appropriate relationship between spring_break_2018 and volunteer that multiple volunteers can participate in the same volunteer opportunity. Write and submit the SQL code to create spring_break_2018 and/or alter volunteer. y relief), the location of the opportunity on), and the cost of the opportunity (e.g. $200). Assume that all costs are in B. Write and submit the SQL code to insert a MINIMUM of 5 records into ring_break_2018. HINT: You will need to have one instance where two volunteersExplanation / Answer
A. The SQL query to create the table spring_break_2018 is:
create table spring_break_2018(id int NOT NULL AUTO_INCREMENT,opp_name varchar(40), opp_loc varchar(20), opp_cost int, PRIMARY KEY(id));
The relationship between volunteer and spring_break_2018 is participate and the cardinality ratio is N : 1. Hence, the primary key of spring_break_2018 will be placed as foreign key in volunteer. The SQL queries are:
alter table volunteer add spid int;
alter table volunteer add FOREIGN KEY(spid) references spring_break_2018(id);
B. The SQL queries to add 5 records are:
insert into spring_break_2018(opp_name,opp_loc,opp_cost) values("Hurricane", "Florida", 300);
insert into spring_break_2018(opp_name,opp_loc,opp_cost) values("Flood", "Georgia", 400);
insert into spring_break_2018(opp_name,opp_loc,opp_cost) values("Earthquake", "Alaska", 200);
insert into spring_break_2018(opp_name,opp_loc,opp_cost) values("Landslide", "Oregon", 100);
insert into spring_break_2018(opp_name,opp_loc,opp_cost) values("Tornado", "Texas", 500);