Shelly Cashman Access 2019 | Module 10: SAM Project 1b
City Tours Ltd.
ADMINISTERING A DATABASE SYSTEM
GETTING STARTED
Open the file SC_AC19_10b_FirstLastName_1.accdb, available for download from the SAM website.
Save the file as SC_AC19_10b_FirstLastName_2.accdb by changing the “1” to a “2”.
If you do not see the .accdb file extension in the Save As dialog box, do not type it. The program will add the file extension for you automatically.
Open the _GradingInfoTable table and ensure that your first and last name is displayed as the first record in the table. If the table does not contain your name, delete the file and download a new copy from the SAM website.
· Special Note: SQL Queries
To ensure accurate grading in this project, use the conventions listed below when writing your SQL commands:
· Do not enclose field names and table names in square brackets [] when creating and modifying these SQL queries. All field names and table names consist of single words and do not require brackets.
· Use parentheses () in your SQL code only when specified.
· All SQL commands should end with a semicolon (;).
· Only modify the aspects of the SQL commands that are specified in the assignment steps.
PROJECT STEPS
City Tours Ltd. is a company that provides tours in a city that attracts tourists from around the country. As the customer service manager for the company, you need to be able to use the extended management capabilities available through SQL.
Create a new query in SQL View based on the TourTypes table with the following requirements:
Add all fields from the TourTypes table to the new query using the asterisk (*) in the SELECT clause.
Be sure to end the SQL command with a semicolon (;).
Run the query to produce the results shown in Figure 1.
Save the query using TourTypesQuery as the query name.
Confirm that your query results match those shown in Figure 1 and save the query. There should be five records in the query result. Close the query.
Figure 1: TourTypesQuery Results
Open the GuidesQuery in SQL View, and then add the LastName field to the SELECT clause after the FirstName field. Run the query and confirm that the results match those shown in Figure 2. There should be 11 records in the query result. Save and close the GuidesQuery.
Figure 2: GuidesQuery Results
Open the TotalCostQuery in SQL View. Add a computed field to the SELECT clause (after the AdultCost field) as described below:
The computed field should calculate the total cost for the home tour by multiplying the NumAdult and the AdultCost field values. (Hint: Enter NumAdult*AdultCost as the computation.)
Use TotalCost as the name (alias) for this computed field. (Hint: Use the AS clause.)
Run the query and confirm that the results match those shown in Figure 3. (Hint: Your records may be in a different order.) There should be 11 records in the query result.
Save and close the TotalCostQuery.
Figure 3: TotalCostQuery Results
Open the AdultCostCriteriaQuery in SQL View. Add a WHERE clause to the query in the position shown in Figure 4 that restricts retrieval to only those confirmations where the adult cost is greater than 50. (Hint: Figure 4 demonstrates the proper location for the WHERE clause, but it does not show the criteria that should be included in the WHERE clause.) Run the query, and check your results to confirm that eight records meet the criteria. Save and close the AdultCostCriteriaQuery.
Figure 4: AdultCostCriteriaQuery in SQL View
Open the CustomerRegionsQuery in SQL View. Add an OR clause to the WHERE clause in the query so that the query retrieves only those records in which the Region field is equal to MidAtlantic or Southeast. (Hint: Currently, the query only retrieves records where the Region field is equal to MidAtlantic.) Run the query and ensure that the results match those shown in Figure 5. (Hint: Your records may be in a different order.) There should be 14 records in the query result. Save and close the CustomerRegionsQuery.
Figure 5: CustomerRegionsQuery Results
Open the CityandStateQuery in SQL View. Add an AND clause to the WHERE clause in the query so that the query retrieves only those records in which the State field is equal to NY and the City field is equal to Buffalo. (Hint: Currently, the query only retrieves records in which the State field is equal to NY.) Run the query, then confirm that the results match those shown in Figure 6. There should be one record in the query result. Save and close the CityandStateQuery.
Figure 6: CityandStateQuery Result
Open the CarriageTourCountQuery in SQL View. Modify the SELECT clause to count the number of confirmations that are for carriage tours with a field value of C001. (Hint: Change the SELECT clause to COUNT(ConfirmationID). Use the AS clause to set the alias of the function result to TourCount. Run the query, and confirm that the results match those shown in Figure 7. The value in the TourCount column should be six. Save and close the CarriageTourCountQuery.
Figure 7: CarriageTourCountQuery Result
Open the JoinToursCustomersQuery in SQL View. Add a WHERE clause that joins the DrivingTours table and the Customers table. The common field in both tables is CustomerID. You will need to qualify the CustomerID field in the WHERE clause. Run the query, and confirm that the results match those shown in Figure 8. (Hint: Your records may be in a different order.) There should be 11 records in the query result. Save and close the query.
Figure 8: JoinToursCustomersQuery Results
Open the GuidesStartDateQuery in SQL View. Add a caption to the StartDate field in the SELECT clause. (Hint: Use the AS clause.) Use DateHired as the caption for the StartDate field. Run the query, and confirm that the last field in the query displays as DateHired, as shown in Figure 9. Save and close the GuidesStartDateQuery.
Figure 9: GuidesStartDateQuery Results
Open the RateSortQuery in SQL View. Modify the query to sort the records in ascending order by the HourlyRate field. (Hint: Use the ORDER BY clause.) Run the query, and confirm that the results match those shown in Figure 10. Save and close the RateSortQuery.
Figure 10: RateSortQuery Results
Open the GroupbyStateQuery in SQL View. Modify the query by completing the following tasks:
Add the State field to the SELECT statement. The State field should appear before the COUNT(CustomerID) function.
Group the records by the State field.
Sort the records by the State field in ascending order.
Run the query, and confirm that the results match those shown in Figure 11. There should be 14 records in the query result. The state on the first record should be CT, and the state on the last record should be VT. Save and close the GroupbyStateQuery.
Figure 11: GroupbyStateQuery Results
Open the CustomerSortQuery in SQL View. Modify the query to sort the records first in descending order by the State field, and then in ascending order by the City field. (Hint: Use the ORDER BY clause.) Run the query, and confirm that the results match those shown in Figure 12. The city and state on the first record should be Burlington, VT. The city and state on the last record should be Hartford, CT. Save and close the CustomerSortQuery.
Figure 12: CustomerSortQuery Results
Save and close any open objects in your database. Compact and repair your database, close it, and then exit Access. Follow the directions on the SAM website to submit your completed project.
Get The Answer for 19.99 USD, Click the button below to buy.