Answered You can buy a ready-made answer or pick a professional tutor to order an original one.

QUESTION

After receiving 21 different setups, the management of Oak Creek Stadium has decided on the attached ER diagram and instance tables for the development of a database to keep track of its operations.

Project Description:

After receiving 21 different setups, the management of Oak Creek Stadium has decided on the

attached ER diagram and instance tables for the development of a database to keep track of its

operations. Your team has been contracted to implement the database in the MySQL relational

database management system (RDBMS).

The following restrictions on the data were discussed in the initial meeting:

- Customer Height will be measured in inches

- Sport Type is either basketball, hockey, football, or soccer

- Food Type is either drink, snack, or main dish

- Restaurant Type is either concession stand or sit down restaurant

- The Departments are Ticketing, Food Service, Gift Shop, Maintenance, and Security

- Multiple food orders occurred on March 17th, 2020.

- All events and orders occurred in 2020.

**NOTE: Use the standard solution at the end of this description

to complete the rest of the assignment.**

4. Querying in MySQL (40 points)

A new management team has taken over Oak Creek Stadium due to its poor financial state.

The CEO believes that the slowing economy may have caused attendance at sporting events

to decrease. The CEO also believes that workforce reduction efforts need to be put in place

in order to improve Oak Creek Stadium’s financial standing. As a part of the reorganization

efforts, the CEO has requested that your team provide reports that will be used in the

organizational review.

Develop the following SQL queries:

a. The CEO is considering increasing ticket sales to improve the financial standing

of Oak Creek Stadium. The CEO requested a report that lists the average event

ticket price paid per customer. The list should only include the customer ID

and the average ticket price.

Select customerid,avg(ticket_price) from attendance group by customerid;

b. As a part of the workforce reduction effort, the Oak Creek Stadium CEO is

looking to layoff some employees in order to reduce overhead. Your team

received a request to provide a list of the full names of all employees, their

department, and their hire dates, listed in chronological order (by hire date).

Select concat(E_FName,concat(' ',E_LName)) as FullName, departmentId,E_HireDate from employee order by E_HireDateasc;

c. The CEO also wants a report of the total number of employees in each

department, listed in alphabetical order by department name.

d. In order to support the claim that attendance at sporting events is low, the CEO

requested a list of all sporting events in chronological order. The CEO would

like to see the sport type, home team ID, and visitor team ID in the report, as

well as the total number of customers that attended each event as “Number of

Customers in Attendance”.

e. Another approach to reducing overhead is to look at the top earners at Oak

Creek Stadium. Your team received a request to provide a list of all the

managers (displaying their full name as one field called “Manager Name”), thename of their department, and their salary (formatted as a $xx.xx). This list

should be in decreasing order based on salary.

f. The CEO wonders if there should be more holiday-themed promotions to

encourage food purchases at events. Your team received a request to provide a

list of all foods that have been ordered on March 17th, 2020, specifically the

food name, the total quantity sold, and the total sales (qty * price). The price

should be formatted as a $xx.xx.

g. The CEO is also considering offering p

romotions to encourage fans to attend

more than one sporting event. The report requested should include the customer

ID, full customer name of customers who have only attended one sporting

event. The report should also include the sport type of the event that was

attended.

h. It is discover

ed that season pass sales have also been decreasing. The CEO

wants to send a promotion to all current and past season pass holders. Your

team received a request to provide a list of the season pass holder ID, the full

name of the season pass holder, the expiration date of the season pass, and the

number of events that they have attended.

Select temp. FullName, SeasonPass. SeasonPassID, SeasonPass. ExpirationDate,temp. numberOfevents from SeasonPass inner join (Select concat(C_FName, concat(' ',C_LName)) as FullName, Customer. SeasonPass_ID ,d.number  as numberOfevents from Customer inner join (Select CustomerID,count(EventID) as number from Attendance group by CustomerID) as d on d. CustomerID= Customer. CustomerID) as temp on temp. SeasonPass_ID= SeasonPass. SeasonPassID;        

i. The CEO wants to thank all of the teams that have played at the stadium by

sending a letter to their coaches. The report requested should include all the

details of the teams that have played at the stadium.

Select distinct Team. TeamID, Team_Name,Coach_FName,Coach_LName ,City, State from  Team inner join Event on Event. HomeTeamID = Team. TeamID UNION Select distinct Team. TeamID, Team_Name,Coach_FName,Coach_LName ,City, State from  Team inner join Event on Event. VisitorTeamID = Team. TeamID;

j. In order to boost employee morale during the workforce reduction, the CEO

wants to give an award to the top employees who had the highest food sales in

2020. The report requested should list the employee ID, the employee’s full

name, and their grand total of food item sales (qty * price). List the employees

from the greatest sales to the least. Exclude total sales that are less than $200.

Select  temp. EmployeeID,temp. totalsales,CONCAT(E_FName,CONCAT(' ',E_LName)) as FullName from (Select (FoodOrders.Quantity * Food.Food_Price) as totalsales,EmployeeID from FoodOrders inner join Food on FoodOrders. FoodItemID = Food. FoodItemID group by EmployeeID) as temp inner join Employee on Employee.EmployeeID = temp. EmployeeID and temp.totalsales> 200;

5. Views in MySQL (15 points)

To protect the data in the database, your team should develop a View and write the SQL

script for it. This view is specifically for employees so that they can see their employment

data. Include their employee ID, their full name, the date and time of the task they

completed, and the task name.

Show more
  • @
  • 165 orders completed
ANSWER

Tutor has posted answer for $40.00. See answer's preview

$40.00

* ** a ****** *** ****** **** ***** **** **** * Primary *** constraint Foreign ************** ***** ********** *** other constraints as ******* ** *** ************* ********************** ***** ********** (SeasonPassID ********** *** ****************** Date *** nullprimary key(SeasonPassID));create ***** ******************* ********** not **** C_FName *********** not *********** *********** *** nullC_Height INTEGER(7) not nullSeasonPass_ID INTEGER not *********** key(CustomerID) ******* key(SeasonPass_ID) ********** ************************ ******** ***** *********** ********** *** nullTeam_Name *********** not nullCoach_FName *********** *** nullCoach_LName *********** not ******** *********** *** **** State VARCHAR(20) *** nullprimary ******************* ***** ************* ********** *** **** ************** DATETIME *** ************* *********** not ****************** INTEGER(4) not ************** ********** not nullVisitorTeamID ********** *** *********** ************ ******* *************** ********** ************ ******* ****************** ********** ************ ***** ********** IN( 'basketball' ******** ********** ******** )));create ***** Attendance(TicketNumber ********** not ************** ********** *** *********** ********** *** **************** FLOAT(52) not **** primary ************************ *************** ********** *************************** ************ ********** ********************** ***** *********************** ********** *** ************* *********** *** ************* ********** *** *********** ********************** (Dept_Name *** 'Ticketing' ***** ******** ***** Shop' 'Maintenance' 'Security' ********** ***** Employee(EmployeeID ********** not *********** *********** *** nullE_LName *********** *** ************** Date *** *************** **** *** nullE_Salary FLOAT(82) *** **************** ********** *** *********** ********************** ***************** ********** ******************************* ***** ********** *** ********** ************* ******* ************** references Employee(EmployeeID);create ***** *************** ********** *** ************* *********** not ************* VARCHAR(15) *** ************** FLOAT(52) not *********** key(FoodItemID)CHECK (Food_Type ********** ******* 'main ***** ********** table Task(TaskID ********** *** ************* *********** *** nullprimary ******************* ***** *************************** ********** not **** EmployeeID ********** *** nullTaskID INTEGER(7) *** **** *********** ******** not *********** ************************ *************** ********** *************************** *********** references ******************** ***** FoodOrders ******** ********** *** **** ********** INTEGER(7) *** ******************* *********** *** **** EmployeeID ********** not **** ********** ******** *** nullCustomerID ********** *** nullQuantity ********** *** *********** key(OrderID)foreign *************** ********** Employee(EmployeeID)foreign *************** ********** Food(FoodItemID)foreign *************** ********** Customer(CustomerID)CHECK (Restaurant_Type ************** ********** ***** )));b ****** **** into **** Table **** up **** *** **** Make **** **** ********* *** ** least ** **** and *********** ****** have ** ********** **** seasonpass *************************** into ********** *************************** **** seasonpass *************************** **** ********** *************************** **** ********** *************************** **** seasonpass value(6'2020-03-17');insert **** ********** *************************** **** ********** *************************** into seasonpass *************************** **** ********** *********************************************************************************************** **** **** value(1'run');insert into task ******************* **** task value(3'eat');insert into task ********************** **** **** value(5'drink');insert **** **** ********************* **** task ******************* **** **** value(8'read');insert **** **** ********************** **** **** value(10'speak');--------------------------------------------------------------------insert **** **** ******************************************* into **** ********************************************* into **** ************************************* *************** **** **** *************************************** into team ******************************************* **** team value(6'Ireland''MK''dek''KG''UK');insert **** **** value(7'Netherland''FK''ref''LG''Bihar');insert **** **** ********************************************* **** team value(9'Australia''ZK''doef''SG''Australia');insert into **** ************ **************************************************************************************************************** **** customer ************************ **** ******** ************************* **** customer ************************* **** ******** ************************ into customer ************************* **** customer ************************ **** customer value(7'ag''be'510);insert **** ******** ************************ **** ******** ************************* **** customer value(10'am''b'55);insert **** customer ************************** **** ******** ************************* into customer *************************** **** ******** ************************** into ******** ************************** into ******** ************************** **** customer value(17'at''bp'51);insert **** ******** value(18'au''b'69);insert **** ******** ************************** **** ******** ************************** **** ******** ************************** **** ******** ************************* **** ******** ************************** **** ******** ************************** **** ******** ************************** **** ******** ************************* **** ******** ************************** **** customer value(28'ea''bx'58);insert into ******** value(29'fa''by'59);insert **** ******** ********************************************************************************************************** **** event ****************** ******************************* **** ***** value(2'2020-03-17 11:00:00''hockey'100032);insert **** ***** ****************** ******************************* **** event ****************** ******************************* into ***** ****************** ********************************* **** ***** ****************** ******************************* into event ****************** ********************************** **** ***** ****************** 10:00:00''football'100012);insert into ***** ****************** 10:00:00''hockey'100032);insert into ***** ******************* ******************************* into ***** value(11'2020-03-25 ********************************* **** ***** ******************* 10:00:00''football'100019);insert into ***** ******************* ********************************** into ***** ******************* ******************************* into ***** value(15'2020-03-07 ******************************** **** ***** ******************* 10:00:00''hockey'100019);insert **** ***** ******************* ******************************* **** ***** ******************* 10:00:00''hockey'100042);insert **** event ******************* 10:00:00''football'100052);insert **** ***** value(20'2020-03-18 10:00:00''hockey'100063);insert **** ***** ******************* ******************************* into ***** value(22'2020-03-20 *********************************** into ***** value(23'2020-03-21 10:00:00''basketball'100082);insert **** event ******************* ******************************* into ***** ******************* 10:00:00''basketball'100036);insert **** ***** ******************* ******************************* **** ***** ******************* *********************************** **** ***** ******************* *********************************** **** ***** value(29'2020-03-14 ******************************* **** ***** ******************* **************************************************************************************************************** into ********** value(111500);insert **** ********** value(232400);insert **** ********** value(313100);insert **** attendance value(421500);insert into ********** ******************** **** ********** ******************* **** attendance ******************** **** ********** value(861500);insert **** ********** ******************** **** ********** ********************* **** attendance value(115720);insert into ********** value(1211500);insert **** ********** ********************* **** ********** value(1485500);insert into ********** value(15101500);insert into attendance ********************* into ********** ********************* **** ********** ********************** into attendance ********************** **** ********** ********************* **** ********** ********************* **** ********** ********************* **** attendance ******************** **** attendance ********************* into ********** ********************** **** ********** ********************* **** ********** ******************** **** ********** value(2851100);insert **** attendance ********************** **** ********** value(308180);------------------------------------------------------------------------------------set ****************** ********* into ********** *************************** into ********** *************************** **** department *************************** **** ********** *************************** into ********** value(5'Ticketing'10);insert **** department value(6'Ticketing'2);insert **** ********** ************ ***************** **** ********** value(8'Food ****************** into ********** value(9'Food Service'14);insert **** ********** value(10'Food ****************** **** ********** value(11'Food Service'17);insert **** ********** ************* ***************** **** ********** value(13'Gift *************** **** department ************* Shop'1);insert **** department ************* Shop'20);insert into ********** ************* Shop'22);insert **** ********** ************* *************** **** ********** ************* Shop'1);insert into department value(19'Maintenance'26);insert into ********** value(20'Maintenance'1);insert into ********** ******************************* into department ****************************** into ********** value(23'Maintenance'30);insert **** ********** ****************************** into ********** *************************** into ********** *************************** into ********** value(27'Security'4);insert **** ********** *************************** into department *************************** **** department *************************** into ********** *************************** **** department *************************** **** ********** *************************** into ********** ******************************* into ********** ******************************* **** ********** ******************************* **** ********** value(37'Maintenance'19);insert into department ******************************* **** department ******************************* **** ********** ******************************* **** department value(41'Maintenance'28);insert **** ********** value(42'Maintenance'29);-------------------------------------------------------------------------insert **** ******** **************************************************** **** employee ***************************************************** into ******** ***************************************************** **** ******** ***************************************************** **** ******** *************************************************** **** employee **************************************************** **** ******** ***************************************************** **** employee value(8'ah''bq''2014-04-12''1970-01-14'200032);insert **** employee ***************************************************** **** ******** ***************************************************** into employee ***************************************************** **** ******** value(12'ab''bl''2014-08-12''1970-02-12'30008);insert **** ******** value(13'ac''bm''2014-09-12''1972-01-12'400035);insert **** ******** ***************************************************** **** employee ***************************************************** into ******** value(16'af''bo''2014-12-12''1975-01-12'500010);insert **** ******** value(17'ag''bp''2014-01-13''1977-01-12'600011);insert **** ******** ****************************************************** into ******** ****************************************************** **** employee ****************************************************** into ******** ***************************************************** **** ******** ****************************************************** **** employee ****************************************************** **** ******** ****************************************************** **** employee ***************************************************** into ******** value(26'af''bo''2014-01-22''1975-01-12'500019);insert into employee ****************************************************** **** employee ****************************************************** **** ******** ****************************************************** **** employee ********************************************************************************************************************************** **** food ****************************** **** **** ******************************** **** food ******************************* **** **** ****************************** **** **** value(5'beer''drink'7);insert **** **** ***************************** **** **** ***************************** **** **** ****************** dish'20);insert **** **** ****************** *************** into **** ******************** **************************************************************************************** **** ********** ******************* ****************** ******************** into foodOrders value(22'concession ****************** ******************** **** ********** ******************* ****************** ******************* **** ********** ************ down'3'2020-03-19 ******************** into ********** value(55'concession ****************** ******************** **** ********** ************ ***************** 10:00:00'110);insert into ********** ******************* ****************** ******************* into ********** ************ down'7'2020-03-17 ******************** into ********** ******************* stand'8'2020-03-14 10:00:00'13);insert into foodOrders ************** down'9'2020-03-13 ******************** into foodOrders value(111'concession ******************* ******************* into ********** value(121'sit down'1'2020-03-17 ******************** into ********** ******************** ****************** ******************* into ********** value(141'concession stand'2'2020-03-11 ********************* **** ********** ************* ***************** 10:00:00'910);insert into ********** ******************** ****************** ******************** **** foodOrders ************* ***************** ******************** into ********** ******************** ****************** ******************** **** foodOrders ******************** ****************** 10:00:00'510);insert **** ********** ******************** ****************** 10:00:00'116);insert **** ********** ************* ***************** ******************** **** ********** value(224'concession stand'7'2020-03-14 10:00:00'318);insert **** ********** ******************** ****************** ******************** **** ********** ************* ***************** ******************** **** ********** value(255'concession stand'1'2020-03-17 ******************** **** ********** ************* down'9'2020-03-17 ******************** into foodOrders ******************** ****************** ******************** into ********** value(286'sit ****************** ******************** **** foodOrders ******************** ****************** ******************** **** ********** ******************** ****************** 10:00:00'110);-----------------------------------------------------------------------insert **** ************** ******************** ***************** **** ************** ******************** 10:00:00');insert **** ************** ******************** ***************** into TaskAssignment value(444'2016-03-16 10:00:00');insert **** ************** value(555'2020-03-15 ***************** into ************** ******************** 10:00:00');insert **** ************** ******************** ***************** **** TaskAssignment ******************** ***************** **** ************** ******************** 10:00:00');insert **** ************** *********************** 10:00:00');insert into ************** ********************* 10:00:00');insert into ************** ********************* ***************** **** ************** value(1333'2015-03-18 10:00:00');insert **** TaskAssignment ********************* ***************** into ************** ********************* ***************** **** TaskAssignment ********************* ***************** into TaskAssignment ********************* ***************** **** TaskAssignment ********************* 10:00:00');insert **** TaskAssignment ********************* ***************** **** ************** *********************** 10:00:00');insert **** ************** ********************* ***************** **** ************** value(2222'2015-03-17 10:00:00');insert **** ************** value(2333'2015-03-18 ***************** into ************** ********************* ***************** **** ************** value(2555'2020-03-15 ***************** **** ************** value(2666'2020-03-17 ***************** **** ************** ********************* ***************** **** TaskAssignment ********************* ***************** **** ************** ********************* 10:00:00');insert **** ************** *********************** ************ ******* * SQL script ** ****** *** ****** database *** ******** all ************** * **** TABLE SeasonPass; **** ***** Customer; drop TABLE ***** **** ***** Event;drop ***** *********** **** ***** Department; **** ***** ********* drop ***** ***** **** ***** ***** **** TABLE *************** **** ***** FoodOrders; d ******* a SQL script ** ****** *** **** ** *** ****** *** ****** *** ************** (ie removing all **** of data) **NOTE: There ** **** **** oneway ** ******** ***** **** *** ** ***************** :TRUNCATE TABLE *********** ******** ***** ********* ******** ***** Team; TRUNCATE ***** Event; TRUNCATE ***** *********** ******** ***** Department; ******** TABLE ********* ******** TABLE ***** ******** TABLE ***** TRUNCATE ***** *************** TRUNCATE ***** ************ a *** *** is considering increasing ticket ***** to ******* *** ********* ********** Oak Creek ******* *** *** requested a ****** **** lists *** average *********** ***** **** *** customer *** **** should **** ******* *** ******** ***** *** average ****** ********** ******* customeridavg(ticket_price) **** attendance group ** ****************** As a **** ** *** ********* reduction ****** *** *** ***** ******* *** islooking ** ****** some ********* in ***** to ****** ******** **** teamreceived a request ** ******* * **** ** the **** ***** ** *** ********* *************** *** their hire ***** listed ** chronological order *** hire date)Query:Select ********************** 'E_LName)) ** ******** departmentIdE_HireDate **** ******** ***** ** ********** asc;c *** CEO **** ***** * ****** ** *** ***** ****** of employees ** eachdepartment ****** ** ************ order ** department **************** Dept_Namecount(*) **** ********** ***** ** ********* ***** ** Dept_Name ***** ** ***** ** ******* the ***** **** ********** at sporting ****** ** *** the ************ a **** of all ******** ****** ** ************* ***** *** CEO wouldlike ** *** *** ***** **** **** team ** *** ******* team ** ** *** report ****** ** *** total number ** ********* **** attended **** event ** “Number *********** ** ****************** :Select ************** *************** ********************************** *********** ** ******* ** ********* ** *********** **** ***** ***** **** ********** ** eventEventID= ***************** Group by ************ ***** ** eventSportType ***** ******* ******** to ******** ******** is to **** ** the top earners ** ******** Stadium **** **** ******** * ******* to ******* * **** of *** themanagers (displaying ***** **** **** as *** ***** ****** ********** ******** ******* ** ***** ********** *** ***** salary ********** ** * ****** **** ********** ** ** ********** order ***** ** salary Query * ****** concat(employeeE_FNameconcat(' * ***************** ** ************************************************************* AS CHAR) * ** ******** from ******** ***** join ********** ** employeeEmployeeID * DepartmentManagerID ***** by **************** ************ *** CEO wonders if ***** ****** ** more ************** ********** *********** **** ********* ** events Your team ******** a ******* to ******* ***** ** *** ***** **** **** **** ordered ** ***** 17th **** specifically ******* **** *** ***** quantity **** and the ***** ***** **** * ****** The *********** ** ********* as a $xxxxQuery:Select *************************** ********* ** totalquantity ****************************** ************************* ** CHAR)) as ********** from **** ***** join FoodOrders ** foodFoodItemID * ********** ********** *** *************************************** ***** ** **************** *** *** ** **** considering ******** ********** ** ********* **** ** ********** **** *** ******** event The ****** ********* should ******* *** ********** **** ******** **** of ********* *** **** **** ******** *** ************* *** report ****** also ******* *** ***** **** of *** ***** **** wasattended Query :Select ************************** ************** **** ******* ************** concat(' ********** ** FullNamed CustomerID ** CustomerID dnumberdeventID ** eventID **** ******* ************************ ** ************* from ********** ***** ** *********** as d ***** join ******** ** Customer *********** * ********** *** ******* = ** ** **** ***** join Event ** **** eventID = ***** EventID;h It is ********** **** season **** sales **** **** been ********** *** CEOwants ** **** * promotion to *** ******* and **** ****** pass ******* ******** ******** a ******* to ******* * list ** *** ****** **** ****** ** *** fullname ** *** ****** pass ****** the ********** **** ** *** ****** **** *** thenumber ** events **** they **** ************* :Select **** ******** ********** SeasonPassID SeasonPass ExpirationDatetemp numberOfevents **** ********** inner **** ******* concat(C_FName ******** 'C_LName)) as ******** ******** ************* ******* ** numberOfevents **** Customer inner join ******* CustomerIDcount(EventID) as ****** **** ********** ***** ** CustomerID) ** d ** d CustomerID= ******** *********** ** **** ** temp ************** ********** *************  i *** *** ***** to thank all ** the ***** that **** ****** ** *** ******* bysending * ****** ** their ******* *** ****** ********* ****** ******* *** ********** of *** ***** that have ****** at *** ************** :Select ******** Team ****** Team_NameCoach_FNameCoach_LName City ***** **** **** ***** join ***** ** ***** ********** * Team TeamID ***** ****** distinct **** ****** ******************************* City State **** Team inner **** ***** ** ***** VisitorTeamID * **** TeamID;j In ***** ** boost employee morale ****** the ********* ********* *** CEOwants ** **** an award ** *** *** ********* who had *** ******* **** sales ****** The report ********* should **** *** employee ** *** employee’s fullname *** ***** ***** ***** ** **** **** ***** (qty * ****** List the ************* *** ******** sales ** *** ***** ******* total ***** **** *** **** than ********* ******* temp ************** ******************************** ********** ** FullName **** ******* ******************* * *************** ** ******************** **** ********** ***** join **** on ********** FoodItemID * Food ********** ***** ** *********** ** temp ***** **** ******** on EmployeeEmployeeID * **** EmployeeID and ************** > ****

Click here to download attached files: Database system SQL.docx
or Buy custom answer
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question