Question: Write a SQL query to select all columns of the Cafe table to inspect the table. The resulting table may look like: census_tract county

Write a SQL query to select all columns of the Cafe table to inspect the table. The resulting table may look like: census_traWrite a SQL query to calculate the total and average number of Starbucks and Dunkin Donuts (Names of columns do not matter. IWrite a SQL query to calculate the total and average number of Starbucks and Dunkin Donuts stores by each county (Names of coAfter joining Cafe and HousePrice tables, write a SQL query to calculate average house price index, average income, and avera  
 
 

Write a SQL query to select all columns of the Cafe table to inspect the table. The resulting table may look like: census_tract county dunkin_donuts starbucks 25005600100 Bristol 0 0 25005600202 Bristol 0 0 25005600203 Bristol 0 1 25005600204 Bristol 1 0 25005610100 Bristol 1 0 25005610202 Bristol 2 0 25005610203 Bristol 1 0 25005610204 Bristol 0 Write a SQL query to calculate the total and average number of Starbucks and Dunkin Donuts (Names of columns do not matter. If needed, you can use an alias for each column). The resulting table may look like: total_starbucks avg_starbucks total_dunkin_donuts_avg_dunkin_donuts 126 0.1613 0.7964 622 Write a SQL query to calculate the total and average number of Starbucks and Dunkin Donuts stores by each county (Names of columns do not matter. If needed, you can use an alias for each column). The resulting table may look like: county total_starbucks avg_starbucks total_dunkin_donuts avg_dunkin_donuts 1.0667 Bristol 6 0.0667 96 Essex 18 0.1286 111 0.7929 Middlesex 63 0.2405 183 0.6985 Norfolk 26 0.2167 104 0.8667 Plymouth 11 0.1146 83 0.8646 Suffolk 2 0.0274 45 0.6164 After joining Cafe and HousePrice tables, write a SQL query to calculate average house price index, average income, and average population of the neighborhoods where median income is lower than the overall average and there is at least one Starbucks store. How about those of the neighborhoods where median income is lower than the overall average and there is no Starbucks store? If needed, you can write multiple SQL queries at once, which are separated by a semi-colon (;). Names of columns do not matter. If needed, you can use an alias for each column.

Step by Step Solution

3.43 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 SELECT from cafe 2 SELECT SUMstarbucks as totalstarbucks AVGstarbucks as avgstarbuck... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!