Reference no: EM133437893
Question: Now you decide to pull all the information you've developed together.
Write a query that shows the player's Total_bases_touched from question #5, the batting_averages from #9 (between .2and .4999)
and the player's name as formatted in #8. You also want to add the teamid and the team's batting average for the year.
The teams batting average should be calculated using the columns with the same names, but from the TEAMS table.
As a final piece of information, calculate the percentage of the team's batting average divided by the player's batting average.
Also replace the Teamid with the team name in your ourput. Note, a percentage over 100% indicates the player is better than the average batter on the team.
Additionally, rename the tables to only use the first letter of the table so you can use that the select and where statement (ex: FROM TEAMS T).
This saves a considerable amount of typing and makes the query easier to read. Order the results by batting average in descending order then playerid and yearid id ascending order.
Also, eliminate any results where the player has an AB less than 50. Your query should return 44,272 rows.