Question

In: Computer Science

Great Food Restaurants (GFR), is a national chain of restaurants with locations in all 50 states....

Great Food Restaurants (GFR), is a national chain of restaurants with locations in all 50 states. The GFR relational database consists of nine tables as shown below. Note the following information about GFR and its database:

  • Each restaurant has a unique restaurant number.
  • Restaurant size is measured in square feet. Restaurant capacity is the number of patrons the restaurant can seat at one time.
  • Suppliers supply food to GFR restaurants. Supplier name is unique in the SUPPLIER table.
  • GFR has an aggressive marketing campaign in which it tracks each customer as they patronize GFR restaurants. Customer number is unique across the country.
  • In the VISIT table, the Bill is the amount of money the customer spent in a particular GFR restaurant on a particular day. Assume that a customer can go to a particular restaurant only once in a given day.
  • Employee number is unique across the GFR chain. In terms of employment, GFR is interested in keeping track only of the GFR restaurant that an employee currently works in.
  • State names and region names are unique.
  • Inspector numbers are only unique within a state.
  • Assume that all states score restaurant inspections on the same 1-100 scale.

RestNum

Address

City

State

Size

Capacity

AnnualSales

RESTAURANT

SuppName

City

State

Phone

YearFounded

SUPPLIER

RestNum

SuppName

Food Type

Date

Cost

FOODDELIVERY

CustNum

Name

CellPhone

City

State

CUSTOMER

RestNum

CustNum

Date

Bill

VISIT

EmpNum

EmpName

YearHired

JobTitle

Salary

RestNum

EMPLOYEE

State

Region

InspectionOfficePhone

InspectionCommissionerName

STATE

State

InspectorNum

InspectorName

InspectorEmail

INSPECTOR

RestNum

State

InspectorNum

Date

Score

INSPECTION

There are 6,000 records in the RESTAURANT table.

There are 200 records in the SUPPLIER table.

There are 1.5 million records in the FOODDELIVERY table.

There are 450,000 records in the CUSTOMER table.

There are 15 million records in the VISIT table.

There are 500,000 records in the            EMPLOYEE table.

There are 50 records in the STATE table.

There are 300 records in the INSPECTOR table.

There are 98,000 records in the INSPECTION table.

Questions

1. What would you do to improve the performance of queries to find a customer by name or would you do nothing? Why?

2. What would you do to improve the performance of queries to find a supplier by phone number or would you do nothing? Why?

3. What would you do to improve the performance of queries requiring a list of the complete records of every GFR restaurant in Tennessee together with a list of their employees, including employee number, name, and salary or would you do nothing? Why?

4. What would you do to improve the performance of a query that seeks the salary of the highest paid employee of any GFR restaurant in Tennessee or would you do nothing? Why?

Solutions

Expert Solution

1. What would you do to improve the performance of queries to find a customer by name or would you do nothing? Why?

Answer: Finding a customer by name could be a tricky task as the resturant which is spread in alomst 50 states can have the record of the multiple customer with the same name. Hence, to improve the performance of queries, we can further ask for more unique and specific information like 'CustNum' in CUSTOMER table. And if the customer somehow unable to provide correct information, we can go ahead and make use of 'name', 'email' and 'cellphone' in CUSTOMER table which will narrow down the result.

2. What would you do to improve the performance of queries to find a supplier by phone number or would you do nothing? Why?

Answer: Just like we narrow downed the result by providing further information, similary here, with the help of SUPPLIER table, we will provide 'city' and 'state' of the supplier we want to find. Futhermore, if we have more specific information like 'SuppName' which is unique in the SUPPLIER table, we can simply use it go get the perfect result.

3. What would you do to improve the performance of queries requiring a list of the complete records of every GFR restaurant in Tennessee together with a list of their employees, including employee number, name, and salary or would you do nothing? Why?

Answer: Here, we will use the concept of 'LEFT JOIN' on table RESTAURANT and EMPLOYEE and the key connceting both the table is 'RestNum'. To do that we will break down the problem statement like this-

Columns to be selected: All from RESTAURANT table and employee number, name, and salary from EMPLOYEE table. i.e.

select restaurant.* , employee.empnum , employee.empname , employee.salary

Left Join RESTAURANT ON EMPLOYEE: from RESTAURANT LEFT JOIN EMPLOYEE

Join Condition: It will help in joining the tables. The conditon has to be evaluated to be TRUE to combine the tables. i.e. ON restaurant.RestNum=employee.RestNum

Additional condition: We want the information of restaurants in only Tennesse. hence, we need to provide another condition which is as follows WHERE state= 'Tennessee'

Now, combine the query-

SELECT restaurant.* , employee.empnum , employee.empname , employee.salary

FROM RESTAURANT LEFT JOIN EMPLOYEE

ON restaurant.RestNum=employee.RestNum

WHERE state= 'Tennessee';

4. What would you do to improve the performance of a query that seeks the salary of the highest paid employee of any GFR restaurant in Tennessee or would you do nothing? Why?

Answer: To obtain the salary of th heighest paid employee of ANY GFR restaurant in Tennessee we will use the EMPLOYEE and RESTUARANT tables.

We could have used only EMPLOYEE table to get the heightest salary but the condition which is given is that it has to be in Tennessee only. And we dont have states specified in the EMPLOYEE table. Hence, we are going to take help from the RESTUARANT table and the key that connectes both the tables is 'RestNum'.

Columns to be selected: Employee name, number and salary from EMPLOYEE table

select employee.empnum , employee.empname , employee.salary

Left Join EMPLOYEE ON RESTAURANT: from EMPLOYEE LEFT JOIN RESTAURANT

Join Condition: It will help in joining the tables. The conditon has to be evaluated to be TRUE to combine the tables. i.e. ON restaurant.RestNum=employee.RestNum

Condition: to find highest salary we will arrange the salary in descending order and pick the result topmost salary. To obtain that, we can write-

ORDER BY salary desc

LIMIT 1

Additional condition: We want the information of restaurants in Tennesse only. hence, we need to provide the condition which is as follows WHERE state= 'Tennessee'

Hence, the query is-

select employee.empnum , employee.empname , employee.salary

from EMPLOYEE LEFT JOIN RESTAURANT

ON restaurant.RestNum=employee.RestNum

WHERE state= 'Tennessee'

ORDER BY salary desc

LIMIT 1;


Related Solutions

A company comprises a chain of 137 restaurants. All food orders for each restaurant are required...
A company comprises a chain of 137 restaurants. All food orders for each restaurant are required to be entered into an electronic device that records each food order by food server and transmits the order to the kitchen for preparation. Food servers are responsible for collecting payment for all of their orders and must turn in the proceeds collected (cash, checks, and credit card receipts) at the end of their shift, which should equal the total sales value of food...
The owners of a chain of​ fast-food restaurants spend $25 million installing donut makers in all...
The owners of a chain of​ fast-food restaurants spend $25 million installing donut makers in all their restaurants. This is expected to increase cash flows by $11 million per year for the next five years. If the discount rate is 6.9​%, were the owners correct in making the decision to install donut​ makers?
Zagat’s publishes restaurant ratings for various locations in the United States. The file Restaurants contains the...
Zagat’s publishes restaurant ratings for various locations in the United States. The file Restaurants contains the Zagat rating for food, décor, service, and the cost per person for a sample of 100 restaurants located in New York City and in a suburb of New York City. Develop a regression model to predict the cost per person, based on a variable that represents the sum of the ratings for food, décor, and service. a. Construct a scatter plot. b. Assuming a...
The owner of two​ fast-food restaurants has recorded customer satisfaction ratings for both locations on a...
The owner of two​ fast-food restaurants has recorded customer satisfaction ratings for both locations on a scale of 1 to 5 ​(5equalsMost ​satisfied). The table linked below summarizes the data. a. Calculate the mean satisfaction rating at each location . b. Calculate the standard deviation of each distribution. c. What conclusions can be drawn from these​ results?
The owner of two​ fast-food restaurants has recorded customer satisfaction ratings for both locations on a...
The owner of two​ fast-food restaurants has recorded customer satisfaction ratings for both locations on a scale of 1 to 5 ​(5 =Most ​satisfied). The table linked below summarizes the data. Rating Restaurant A Restaurant B 1 5 15 2 13 14 3 9 17 4 33 18 5 25 16 a. Calculate the mean satisfaction rating at each location. b. Calculate the standard deviation of each distribution. c. What conclusions can be drawn from these​ results? Here is where...
A national chain of women’s clothing stores with locations in the large shopping malls thinks that...
A national chain of women’s clothing stores with locations in the large shopping malls thinks that it can do a better job of planning more renovations and expansions if it understands what variables impact sales. It plans a small pilot study on stores in 25 different mall locations. The data it collects consist of monthly sales, store size (sq. ft), number of linear feet of window display, number of competitors located in mall, size of the mall (sq. ft),and distance...
A national chain of women’s clothing stores with locations in the large shopping malls thinks that...
A national chain of women’s clothing stores with locations in the large shopping malls thinks that it can do a better job of planning more renovations and expansions if it understands what variables impact sales. It plans a small pilot study on stores in 25 different mall locations. The data it collects consist of monthly sales, store size (sq. ft), number of linear feet of window display, number of competitors located in mall, size of the mall (sq. ft),and distance...
For example, Dicks Burger is a popular fast food with multiple locations in the United States....
For example, Dicks Burger is a popular fast food with multiple locations in the United States. In order to achieve fast-growing, Dicks Burger would like to open stores in other countries. (Please response in 700-800 words) a) Identify the environmental factors (economic, social/cultural, environmental, etc.) of a new location that you think would be important to the future success of Dicks Burger. Provide detailed analysis for each environmental factor you have chosen. b) Which countries would you recommend to Dicks...
As the quality engineer for a small chain of fast food restaurants called McDowell’s (They’ve got...
As the quality engineer for a small chain of fast food restaurants called McDowell’s (They’ve got the Big Mac, we’ve got the Big Mick), you’re interested in describing the consistency of the foodstuffs at a particular branch. In particular, you want to develop graphical and numerical representations of the (i) weight of and (ii) number of fries in a small bag of McDowell’s fries. You’ll find a sample of 32 bags in the file Homework 3.xlsx in the Homework Data...
Prezzo plc runs a chain of restaurants in the UK that serve mainly Italian style food...
Prezzo plc runs a chain of restaurants in the UK that serve mainly Italian style food including pizza, pasta, and grilled dishes as well as a few Chimichanga Mexican restaurants. During 2012, the number of restaurants in the group increased from 184 to 210. Prezzo shares are listed on AIM, which is a stock market for smaller growing companies. Extracts from Prezzo’s annual report 2012, including financial statements for the year to 30 December 2012 and extracts from the director’s...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT