70 likes | 153 Views
Queries Exercise. Save and Open Baseball_Statistics.accdb Create the appropriate relationships for the following tables. Enforce referential integrity and cascade updates, but not cascade deletes. a. Statistics and Teams b. Teams and Divisions c. Teams and Leagues. QueryA.
E N D
Queries Exercise • Save and Open Baseball_Statistics.accdb • Create the appropriate relationships for the following tables. Enforce referential integrity and cascade updates, but not cascade deletes. a. Statistics and Teams b. Teams and Divisions c. Teams and Leagues
QueryA • Create a new query. For each team, list its full team name, full league name, and sum the total number of wins, losses, runs scored, and runs allowed. Sort by total number of wins in descending order. HINT: This query returns 30 records.
QueryB • Create a new query. List each full team name and display the number of wins and losses of that team for the 2009 season. Do not show the season in your result. You should also include a calculated field that determines the win percentage of each team. • You can calculate the win percentage of a team using the formula:
QueryBContd • Format the win percentage as a fixed type number with 3 decimal places. Sort by win percentage in descending order. • HINT: Your query should return 30 records.
QueryC • Write a new query that for each division and league calculates the average number of runs scored and the average number of runs allowed in 2009. • Format the average runs scored and average runs allowed as a fixed type number with 3 decimal places. • Sort by average runs scored in descending order. HINT: Your query should return 6 records.
QueryD • Create a new query that determines if each team has a winning or losing season. Using only the results of QueryB as input, show the full team name and win percentage of that team. • Include a calculated field using the IIF() function that indicates if a team had a winning season (won at least 50% of games) or not. If a team had a winning season, output Winning Season ; otherwise, output Losing Season . • Sort by team name in ascending order. HINT: Your query should return 30 records.
Reports • Let us put things into a visually professional format suitable for printing • Creation can be somewhat like doing Forms with Subforms…. • Using the REPORT WIZARD, create a report to show the results of QueryA. Display all fields from the query. • Group by league name and sort by team name in ascending order. Use a stepped layout, landscape page orientation, and a design style of your choice. Name the report LeagueSummary .